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 ...