Game Development Reference
In-Depth Information
Figure 7-5. Adding all Drone sprites to a common parent object
As with the weapon objects created in the previous chapter, the sprite instances added here will
act as frames of animation for when the Enemy walks around the level or attacks the Player. These
frames will be shown using the SpriteShowAnimator component (coded in the previous chapter).
This component effectively toggles the visibility of sprite objects over time, ensuring only one frame
is visible at once. The result is a flipbook animation effect. For the enemy object, however, we'll need
two SpriteShowAnimator components, one for each animation type: Attack and Walk . Each Enemy
will either be walking around or attacking the Player. More on these states later when we explore finite
state machines. But here, it's enough to confirm that each Enemy relies on two animations: so let's
add two SpriteShowAnimator components and configure each one. The move animation consists of
four frames: spr_drone_run_01 , spr_drone_run_02 , spr_drone_run_03 , and spr_drone_run_04 . The
attack animation consists of two frames: spr_drone_attack , and spr_drone_neutral (see Figure 7-6 ).
 
Search WWH ::




Custom Search