Skip to Main Content
Learning iPhone Game Development with Cocos2D 3.0
book

Learning iPhone Game Development with Cocos2D 3.0

by Kirill Muzykov
June 2014
Beginner to intermediate content levelBeginner to intermediate
434 pages
9h 49m
English
Packt Publishing
Content preview from Learning iPhone Game Development with Cocos2D 3.0

Time for action – animating the shooting and limiting the shooting rate

We will continue to add states to the game objects, and this time, we will update the Hunter class. We're going to animate the process of reloading the arrow and will limit the shooting rate. Let's do this using the following steps:

  1. Open the Hunter.h file and add HunterState enum right after the last #import directive:
    typedef enum HunterState
    {
        HunterStateIdle,
        HunterStateAiming,
        HunterStateReloading
    } HunterState;
  2. Then, add a property called hunterState to the Hunter class as follows:
    @property (nonatomic, assign) HunterState hunterState;
  3. Add a declaration of the method called getReadyToShootAgain using the following line of code:
    -(void)getReadyToShootAgain;
  4. Switch to the Hunter.m ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple's SceneKit and SpriteKit

Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple's SceneKit and SpriteKit

James Goodwill, Wesley Matlock

Publisher Resources

ISBN: 9781782160144Supplemental Content