O'Reilly logo

Learning Objective-C by Developing iPhone Games by Amy M. Booker, Joseph D. Walters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using touch start, move, and end

Let's continue with the gameplay area. For the actual game, we are going to need a few things, such as a background with the play area, a score or stroke counter, a ball, and a cup for the ball to fall into. We want the player to be able to touch and drag in the direction they choose for the ball, which will also determine the speed based on the distance the player drags their finger. We will need to have an area in which the ball will be contained and whenever the ball hits a wall, we want it to bounce back.

We are going to have to add four methods to manage our touches. Let's take a quick look at these before we get into the game code. When a user first places their finger down, touchesBegan sends a message with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required