In this lesson we are going to create a challenging Pong game!
Step 1: Getting ready
The first thing we need to do is to edit the sprite.
Select the cat and click on the costume tab and clear the sprite.
Draw a new sprite with the tools.
This sprite will be the ball in your pong game!
The next step is to choose a background.
Click on the backdrop tab and then choose a background like the one on the right!
Now that we have a backdrop we need to add in a line to the bottom.
Select the line tool and adjust the width
Add a line like the green one.
Step 2: The paddle
Now that we have the ball and the backdrop we now need to create the paddle.
Select the paint brush to create a paddle
Draw with the line tool.
Time to code your paddle!
Create a script to make the paddle move left and right when the keys are pressed.
Step 3: The ball
The next step is to code your ball.
Add scripts to the ball that will interact with the paddle as well as the backdrop.
Get your ball to bounce off the edges of the wall!
To make it more interesting we can add sounds to the game!
The program should make sounds whenever the ball hits the paddle.
The ball should also bounce away when it hits the paddle.
We don’t want it sticking to the paddle!
Step 4: Let’s add a score!
By creating a variable we can keep track of our score!
Name your new variable score
We also need to reset the score if you lose!
To do this we need to set the score to ‘0’ when the ball hits the ground.
Your script for the ball should change the score everytime it hits the paddle.
* Challenge : multiple levels *
If you managed to finish the above well done!!
As an extension we can add levels to the game!
To do this create a new variable but this time call it level
We need to broadcast a new message so they program knows to change level
A new variable called speed needs to be created
Add code to your ball sprite to reset the level and score and increase the speed of the ball.
The level needs to change when your score increases.
The speed should get faster when the level changes.