Game Development Reference
In-Depth Information
The next part is really easy—to build the animation. All you have to do is drag
and drop each sprite into it. Start by dropping the playerSprite_idle_1 sprite.
You'll see that the sprite image appears in the dope sheet, along with a diamond
above it. This diamond represents the position on the timeline that the sprite is
displayed. Now add playerSprite_idle_2 and align its diamond to be two hash
lines after the first. Keep doing this until all four sprites have been added. Your
PlayerIdleAnimation should now look like the following screenshot. If you have
a lot of frames, you can also just drag them all at once by selecting them all in the
Project tab and then dragging them over.
Clicking on the Play button in the Animation tab will now play the sprite animation
on the player object; it looks pretty good, except that it snaps back to the beginning.
To fix this, simply add three additional sprites to the animation after the first
sprites—add playerSprite_idle_3 , playerSprite_idle_2 , and playerSprite_
idle_1 sequentially at the end.
What this does is it now allows the animation to play so that the robot hovers up and
back down, and then the animation loops back to the beginning. Play the animation
again now and it should animate just fine.
 
Search WWH ::




Custom Search