Creating the human enemies class
We need a new class to keep the information on each human enemy, who will try to search and kill the zombie before dying. In this section, you will understand how we're going to implement all of this behavior. Perform the following steps:
First of all, right-click on the Classes group in the project navigator and select New File….
Click on iOS | cocos2d v3.x | CCNode class.
Make this class a subclass of
CCNode
, call itHuman
, and click on Create.
Once the class has been created, open Human.h
and replace its contents with the following lines:
#import <Foundation/Foundation.h> #import "cocos2d.h" #import "CCAnimation.h" typedef enum { humanStateStill = 0, humanStateWalking, humanStateHitting, humanStateDamaged } HumanStates; typedef enum { grandma = 0, businessman } HumanType; typedef enum { humanDecisionStill = 0, humanDecisionWalk, humanStateRun } HumanDecisions; @class Human; // Protocol to implement the human behavior @protocol HumanDelegate...