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:
- Following is the new
processMotionEvent()
that updates the position of the paddle according ...
Get Beginning Android Tablet Games Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.