The most basic question of all has been completely ignored until now. We have dealt with how the game works internally, but we have actually left the player out in the cold. It is precisely because we have done so much "under the hood" work on the snake and its environment that makes the touch handler really anti-climatic. We will focus on the direct user interaction. (There is additional code that handles the game over and some basic splash screens that are outside of the scope of this chapter.)
-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event { CGPoint location = [touch locationInView:[touch view]]; CGPoint convLoc = [[CCDirector sharedDirector] convertToGL:location]; if (convLoc.x < size.width/2) { // Touched left half of the screen [snake turnLeft]; return YES; } else { // Touched right half of the screen ...