It's time to go back in time, and recreate a game that helped to launch the video game industry. It has gone by many names such as Pong, Ping Pong, and Table Tennis, but the basic gameplay has stayed the same. Two paddles, one ball, and an epic battle to get the ball past the other player.
So, let's break down this game. We will require:
After creating a new project, you will be presented with the white stage and a Scratchy sprite.
Left
.We are going to create three simple scripts for this paddle, as follows:
60
percent. You should experiment with the size to determine what feels right for your game.Right
. We now have the beginning for making our right paddle. You will be making a few adjustments, so that a second player will control the paddle.We change the direction in which the paddle is pointing to ensure that it faces the right direction. You then need to change the keys that you will be using for the second player to move the paddle up and down. In this example, we use the up and down arrow keys.
On the stage itself, drag and drop your paddles into the proper positions. The left paddle should be on the left-hand side of the stage, but not touching the wall, while the right paddle should be on the right-hand side, while also leaving a gap between the paddle and the wall.
When you have made your choices, click on the green flag button and test your game. The paddles should be able to move up and down.
Now, it's time to create the heart of the program: the ball!
To get started, let's create a new sprite:
Ball
.Left Score
and Right Score
and set them to be used by all sprites.20
percent, and set both left score and right score to 0
.5
steps. We now have another new block, If on edge, bounce. This block tells the ball that if it has touched the outer edges of the screen, it should bounce away from it.if
statements. These come into effect if the ball touches either the left or the right paddle. If it touches either, we have the ball point in the opposite direction, and then pick a random direction to move in.if
statements are the most important ones. These check whether the ball has gone behind either of the paddles. If it has, it awards a point to the other paddle, and moves the ball back into the middle of the stage. The game then continues!You now have the beginning of your Ping Pong game! Where can you go from here? Here are a few ideas:
The rest is up to you! Have fun and experiment!
18.219.43.126