Game Development Reference
Launch the game in Preview and check the appropriate behavior.
You can open the file MyFirstPong_step8.gameproj to reach this step.
Do You Have the Touch?
The real fun begins now! You will start using some of hardware functions of the
iOS device. The first one is the touch interface of your device. You will
implement two functions. The first one will spawn a ball when you tap the
screen. The second one will move the Rack Player 1 with your finger.
Serving with a Pinch of Touch
You will implement touch serving for Player 1 only. The idea is that by the end of
the chapter you will be able to play Player 1 against the computer!
To do so will take you about 5 seconds. Yes, you read correctly! Only 5
Double-click Rack Player 1 to open the actor in editor mode. Modify the Serving
rule's first condition: replace ''key'' with ''touch.'' Then select ''outside.'' So
instead of having the player press the space bar down to spawn a ball, the
player will touch the screen and the racket will spawn a ball. Your Serving rule
should look like Figure 3-14.
Figure 3-14. Serving with a touch