The most interesting part is making some character live, which we are going to do in this part. We will be detecting a touch on the screen and then applying some cool actions on some nodes, that is, moving the spaceship up and down.
To make the character move, you should know the basic actions (SKAction
) that can be applied on nodes (SKNode
).
Now, as we have got the spaceship moving in infinite space, it's time to add some more fun in the game. We will now be adding the up-down motion to our spaceship. Perform the following steps to add the up-down motion to the spaceship:
Declare some properties for actions, namely up and down actions in
FSMyScene
.@property (nonatomic, strong) SKAction* moveUpAction; @property (nonatomic, strong) SKAction* moveDownAction;
Define the distance and over what time the spaceship will move on a screen touch just above the implementation of
FSMyScene
.static const float SPACE_BG_ONE_TIME_MOVE_DISTANCE =...