2D Toolkit Forum

2D Toolkit => Support => Topic started by: JakeTBear on February 07, 2014, 08:31:15 pm

Title: From tk2dSprite to animation
Post by: JakeTBear on February 07, 2014, 08:31:15 pm
Hello,

I have a sprite that doesnt animate, but upon click I want to change it into an animated sprite, I have thought of some ways of doing it (swapping the object for an animated sprite version) but I was wondering if there was another way to do this (in script), any direction towards the best solution would be highly appreciated! thanks :D
Title: Re: From tk2dSprite to animation
Post by: unikronsoftware on February 07, 2014, 11:03:44 pm
In tk2d 2.0 onwards, the animator is separate to the sprite. All you need to do is turn off the animator (GetComponent<tk2dSpriteAnimator>().enabled = false) if you don't want it to animate.
Title: Re: From tk2dSprite to animation
Post by: JakeTBear on February 07, 2014, 11:22:22 pm
So there 's no need to have an "animated sprite" to have animations? they just need an sprite animator? can I give them this sprite animator at run time (with proper set up, as in giving them the right animation to play).

Thanks again!
Title: Re: From tk2dSprite to animation
Post by: unikronsoftware on February 07, 2014, 11:47:22 pm
The sprite animator is attached to a sprite (any kind of sprite). You still need the sprite itself, but the animator is separate, unlike tk2d 1.x