Game Development Reference
In-Depth Information
Interacting with Our Game
In this chapter, we will discuss the ways in which we can get input from the player.
As there are many different ways to handle user input, we will see the advantages
and disadvantages of each of them. Some of the ways to interact with the game are
as follows:
Touching the screen (taps)
Gesture recognizers
Accelerometer and gyroscope
Game controller events
Handling touches
When the user touches the iOS device screen, our current running scene will receive
a call to one of the following methods:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
-(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)
event
Search WWH ::




Custom Search