(No. 00002) prototype of iOS game genie war (6)
Next, we will add another genie to the MainScene scenario as an enemy.
Double-click MainScene in SpriteBuilder. ccb: drag a CCSprite from the control library to CCPhysicsNode, set the sprite frame to a different dashboard, set the custom class to Player, and name the code link as _ sprite2; open the corresponding physical object and set the content similar to _ sprite1:
With the enemy, you can complete the shooting function. <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Authorization + authorization/e + zcrHtPK/qs7vwO221M/zLLX31fvF9tey0M7XtDo8L3A + DQo8cD48aW1nIGFsdD0 = "here write picture description" src = "http://www.bkjia.com/uploads/allimg/151105/04202621B-1.png" title = "\"/>
Because bullets are not intended to do anything, they do not need custom classes.
Back to Xcode, we need to set up some ivar related to the bullet first. Open MainScene. m and add the following instance variables:
CGSize _viewSize; CCNode *_sprite2; NSMutableArray *_bullets;
In the initialization method of the Main scenario, we need to initialize the "pop-up Warehouse" _ bullets array:
-(instancetype)init{ self = [super init]; if (self) { _bullets = [NSMutableArray array]; } return self;}