Game Development Reference
In-Depth Information
Images in a texture atlas
Texture atlases are also smart. If you run on a retina device and you have two
versions of the atlas—one for the retina and one for regular resolution—it will
use the correct images. All you have to do is have one atlas with all of the images,
but retina images should have a @2x suffix, for example, spaceship.atlas ,
and images such as spaceship1.png and spaceship1@2x.png . Xcode will create
different texture atlases for different devices, so you don't have to worry about
memory and other limitations.
Adding animations to our project
In order to add animations to our endless runner game, we need to perform the
following steps:
1.
Find run.atlas , shield.atlas , deplete.atlas , and jump.atlas in the
resources for this chapter. Drag-and-drop them into the project and be sure
to check Copy items into destination group's folder .
2.
Add the following property to ERGPlayer.h . We will use it to store
animation frames:
@property (strong, nonatomic) NSMutableArray *runFrames;
 
Search WWH ::




Custom Search