To open a Robot.h file in Xcode, add the following 2 methods:
-(void)moveArm:(MoveDirection)direction;-(void)armShoot;
Implement these 2 methods in ROBOT.M:
-(void)armShoot{ [_arm armShoot];}-(void)moveArm:(MoveDirection)direction{ [_arm moveArm:direction];}
Since the player needs to select the robot when clicking on the robot, add the Touchbegan method:
-(void)touchBegan:(CCTouch *)touch withEvent:(CCTouchEvent *)event{ self.isSelectedYES; LevelRestrict *lr = [LevelRestrict sharedInstance]; lr.selectedRobotself; [[MainScene sharedInstance] selectRobot:self]; //将触碰事件向下层节点传递 //[super touchBegan:touch withEvent:event];}
Now add the Selectrobot method to the MAINSCENE.M, the main content is to select a robot, you have to reverse the selection of other robots, at any time only one robot is selected.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
(no.00003) iOS games simple robot projection game forming (15)