O'Reilly logo

Beginning Android Tablet Games Programming by Jeremy Kerfs

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

Adding Touch, Sound, and Rewards

Now you’re ready to finish the application. You need to give the user control over the game paddle, and add sound and some payoffs to engage players.

Adding Touch Control of the Paddle

The AllTogether project used the touch and release of the tablet screen to propel the character forward. In TabletPaddle, the paddle moves horizontally based on the user dragging across the screen. You let the user drag the entire paddle around the screen for the purpose of testing collisions. When you’re finished with the game, you can lock the paddle’s y position by not allowing the user to drag the paddle freely.

Follow these steps:

  1. Following is the new processMotionEvent() that updates the position of the paddle according ...

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