O'Reilly logo

iOS 7 Game Development by Dmitry Volevodz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding shield animations

Other animations and methods that we might want to add are the shield animations. A shield is something that protects the player from different hazards. It has on and off animations. You can check how the effect looks in the following screenshot:

Adding shield animations

The background looks dull

Let's check the course of the action:

  1. Add the following properties to ERGPlayer.h:
    @property (strong, nonatomic) NSMutableArray *shieldOnFrames;
    @property (strong, nonatomic) NSMutableArray *shieldOffFrames;
    @property (strong, nonatomic) SKSpriteNode *shield;
    @property (assign, nonatomic) BOOL shielded;
  2. The first two properties are arrays for animation frames, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required