In this tutorial you will learn fundamental programming concepts by creating Pong
to keep a ball in play. A screenshot of the game is shown:
The functional specification for our game is as follows:
A game screen will be 500px wide and 400 px high. When the window opens, the screen
appears as shown below.
The user will control the paddle with the arrow keys. If the user presses
left arrow key, the paddle will move to the left. If the user presses the
right arrow key, the paddle
will move to the right.
- The player will start the game
by pressing any key other then the left or right arrow key.
- When the game starts, the ball will start moving from a random
- When the game starts, the ball will move in a random direction.
- The ball will bounce off the top, left, or right wall.
- The ball will bounce off the paddle.
- Whenever the player hits the ball with the paddle, the player gets a point.
- The score is displayed.
- If the ball passes the paddle, the ball stops and the game is over.
- When the game is over, the message "Click any key to start" appears.