Chapter 5
Reacting to Player Input
An important element of a game is that it reacts to what the player is doing. On iPhones or iPads, games mainly respond to touch input by the player, which also holds true for the games you develop while reading this book. Some games also use other input data such as the built-in accelerometer, which I’ll briefly discuss in this chapter. In order to deal with input data, you’re going to need a few new programming concepts, such as the if instruction, which will be introduced in this chapter.
Dealing With Touch Input
Any Apple device using a touch screen can track multiple fingers and how they move over the screen. The finger movements that a user makes can be interpreted as gestures (such as swiping to move ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access