Building a simple game of Pong
Create a new project called Pong
, and leave all the settings at their defaults.
Adding sound files to the project
Using your operating system's file browser, go to the app/src/main
folder of the project and add a new folder called assets
.
There are four sound files already made for you in the Chapter 28/Pong/assets
folder of the download bundle. Place these four files into the assets
directory you just created, or you can use some sound effects you create yourself. The important thing is that their filenames must be beep1.ogg
, beep2.ogg
, beep3.ogg
, and loseLife.ogg
.
Coding the ball
Create a new class called Ball
. Unsurprisingly, this class will handle everything to do with the ball in the game. We will code it in eight ...
Get Android Programming for Beginners 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.