Game Development Reference
In-Depth Information
In the
startRunningAnimation
method, we do the same action that we did before
in the
init
block, but we check if the player already has an animation with this key,
and if he does, we do nothing here. In the second method, we find the animation and
remove it, effectively stopping it.
If you change the images in your project or add new ones, Xcode
doesn't make new atlases. In order to do that, execute the
Run
and
Clean
commands from the
Product
menu on the Xcode file menu.
This forces Xcode to recreate texture atlases. You can see this in the
following screenshot:
Next up is the jump animation. We will add it in the same way as before.
The following things need to be done:
1.
Check if you have
jump.atlas
in your project. If you don't, add
jump.atlas
to your project in the same way as
run.atlas
.
2.
Add the following property to
ERGPlayer.h
:
@property (strong, nonatomic) NSMutableArray *jumpFrames;