Game Development Reference
In-Depth Information
It is as simple as calling the Animator::SwitchAnimation() method and passing
the name of the new animation. Keep in mind that passing the name of the animation
which is current playing will reset the time, and the animation will start from the begin-
ning. This means that calling the method during each frame is not a good idea. If we want
to check the name of the animation which is currently playing, we can call Animat-
or::GetCurrentAnimationName() and only switch animations if the new anima-
tion is a different one.
As you can see, the Animator class makes animation easier to manage and, on top of
that, it is extremely scalable. Creating multiple sprites isn't a problem either, as we can
create as many animators as we want.
Search WWH ::

Custom Search