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, ...

Get iOS 7 Game Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.