2D Toolkit Forum

2D Toolkit => Support => Topic started by: mygamingproject on June 15, 2014, 09:34:54 pm

Title: Sprite animations
Post by: mygamingproject on June 15, 2014, 09:34:54 pm
Are sprite animations independent of sprite collections? So if I have a 1x 2x and 4x for different resolutions are sprite animations intelligent enough to pull in the correct one based on resolution identified. Or do I need a different animation per sprite collection like how Unity2D currently handles things?

Your advice would be much appreciated.
Title: Re: Sprite animations
Post by: unikronsoftware on June 16, 2014, 01:25:53 pm
The animations will load the correct sprite collection for the current platform transparently. You dont need different animations for different platforms.
Title: Re: Sprite animations
Post by: rakkarage on June 17, 2014, 07:59:23 pm
what about changing sprites in other animations?
if i have one mob with 15 'skins'?
i can and did make 15 'duplicate' (except initial offset) animations but maybe there is a better way?
thanks
Title: Re: Sprite animations
Post by: unikronsoftware on June 18, 2014, 10:42:37 am
The tk2dSpriteAnimation class is accessible using scripting. You can do whatever you like with an editor script.
Title: Re: Sprite animations
Post by: rakkarage on June 19, 2014, 03:24:27 pm
i was just wondering if there was a better then making 15 animations all the same except start point

for example maybe i can:

- replace the sprite collection on an animation and it will play using the new frames
  - meaning i would need to create a new collection for each mob skin

- use some kind of offset to shift the start position of the animation around on the sprite sheet

please excuse my ignorance
thanks
Title: Re: Sprite animations
Post by: unikronsoftware on June 21, 2014, 08:18:09 pm
- replace the sprite collection on an animation and it will play using the new frames
Yes, you can do that if you want but Unity will load the same thing mulitple times.

- use some kind of offset to shift the start position of the animation around on the sprite sheet
You can do this on the material but it'll be more effort than what I suggested.

Theres a little pain involved in figuring out the editor script, but once you do you can automate it all. This is by far the most optimal solution for runtime as you're doing all the dirty work, however inefficiently, in the editor.