Hello Guest

Author Topic: Animations with sprites of varying sizes  (Read 6082 times)

Majicpanda

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 62
    • View Profile
Animations with sprites of varying sizes
« on: November 30, 2013, 11:41:04 pm »
I am having major problems telling my artist how to give me a sequence of frames for an animation for use in Unity and tk2d.

We have a large 1000x400 ish map and on it he has made several layers to use in animations.  I could export layers to files trimmed but that would mean an animation exports 1 frame as say 30x40 and another 30x43 if the flames animating are higher than the original frame.

Is this ok and if so how do I get it into tk2d correctly so that the images stack exactly on each other and the extra vertical height is correctly handled?  Ideally if he exported all layers to png I would grab them like Cave1, Cave2, Cave3 and put them in an animation and then manually place it on the map.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Animations with sprites of varying sizes
« Reply #1 on: December 01, 2013, 12:30:57 pm »
I would first try exporting them full sized and let tk2d handle the trimming. Its the easiest way to work and it will automatically position the pivots correctly. It depends on how many of these you have though - if its a very large number of these in a sprite collection, you might run out of memory while doing it.

Majicpanda

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 62
    • View Profile
Re: Animations with sprites of varying sizes
« Reply #2 on: December 01, 2013, 03:34:39 pm »
Ok so if this isn't possible the only other way would be to manually place the pivots at the exact same spot in the collection?

Only about 10 of the images fit into an atlas untrimmed so that'll cause an issue. Even trimmed does the image take up untrimmed space in memory during runtime?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Animations with sprites of varying sizes
« Reply #3 on: December 01, 2013, 05:57:53 pm »
Tk2d trims your images for you, so you don't lose anything by working on untrimmed images anyway. The only potential issue is if you have too many very large images  you could run out of memory.

Majicpanda

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 62
    • View Profile
Re: Animations with sprites of varying sizes
« Reply #4 on: December 01, 2013, 07:18:50 pm »
Run out of memory while trying to create the atlas? Once the game gets built there is no longer a link to the reference image, so a 500x500 image with 30x30 actual data in the center of it gets trimmed to the 30x30 into the atlas and the 500x500 image isn't a problem anymore right?

If I have 30 500x500 images then yes that would be a major problem since you only have about 4.3m pixels to work with in a 2048x2048 max size atlas (mobile).

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Animations with sprites of varying sizes
« Reply #5 on: December 01, 2013, 08:42:22 pm »
Yes only when building the atlas. No potential issues once its built.
It doesn't keep references to the source assets at runtime, so there'll be no difference to you making the trimmed sprites yourself.