Game Development Reference
In-Depth Information
Animations
Some of the sprites now run animation actions:
• The
_player
sprite runs an animation showing him riding the bicycle
(
_rideAnimation
).
• I also added our old friend, the swinging animation, shown when the
_player
sprite is floating (
_floatAnimation
). This is the reason for the odd registration
point on the cyclist sprite, as the swing animation looks better if the sprite's anchor
point is not centered.
• Our group of cyclists is also animated during the introduction section of the game,
and is moved offscreen when the game starts (
_jamAnimate
,
_jamMove
).
• We show a puff of smoke coming out of the chimneys whenever the player jumps.
This animation is stored inside the new
Block.cpp
class and it's created through
a series of actions, including a frame animation (
_puffAnimation
,
_puffS-
pawn
,
_puffMove
,
_puffFade
, and
_puffScale
).
• In
GameLayer.cpp
, when the
_player
object dies, we run a few actions on a
_hat
sprite to make it rise in the air and drop down again, just to add some humor.
Now let's go over the added logic.