5083+ reviews
Order by 16:00 for same day shipping
14 days return
GB
EN
Individual
Business
In this simple project you will learn how to recreate Pong in Scratch.
What is Pong?
In the game Pong you have a ball that falls down. The ball may not fall to the bottom of the screen. You keep the ball up by moving the plateau with your mouse. If the ball touches it, it bounces back up. The goal is to keep the ball up as long as possible.
What is Scratch?
Scratch is a programming program on your Raspberry Pi . In this program you work with function blocks. This means that you do not write the programming text yourself. The blocks with the functions have already been made for you. You put these blocks in a diagram yourself. If you have downloaded the Raspbian software on your Raspberry Pi Scratch should be automatically on your Pi. If not, you must download it.
I program in Scratch on the Raspberry Pi 4 with 4GB. You can also program on the Raspberry Pi 3B+. You can also use the 1 GB or 2 GB with the Pi 4.
Are you programming in Scratch 2.0? Then you can still follow this tutorial. Keep in mind that certain functions may be in a different place. The images may also look different than on your screen. You can follow this tutorial because the code is the same.
Change language.
Your program is probably in English. To follow the steps properly, it is wise to change the language in your program. You can change the language by clicking on the “globe” at the top left of your screen. This icon can be found next to the Scratch logo. Select Dutch.
On the side of the Raspberry Pi 4B are two Micro HDMI ports. Insert the Micro HDMI cable into the left port, and the HDMI end into a monitor or display.
Connect a keyboard & mouse to the USB ports and finally insert the power cable into the USB-C port.
Your setup is now ready to be booted.
When the Raspberry Pi starts up now you will see a desktop on your monitor. When you first start it up you still have to set it up, but that is explained step by step.
First we are going to select the ball. Next to the text: New Sprite: you see a head. Click on it. Now you see all the standard Sprites (characters). If it is correct, you will see the ball icon fairly high up, select it. You can also draw a ball yourself. Then click on the brush. When you have selected something, press OK (Figure 1). You can remove the standard character by clicking on the icon with your right mouse button. Then click on remove.
Figure 1
Now we are going to start with the code for the ball. The ball has to fall into play and bounce against the edge.
Figure 2
Now we are going to find the plateau, again money that you can make this yourself, but you can also find it. Find the plateau in the same way as the ball. The plateau is probably more towards the bottom (Figure 3).
Figure 3
Now we're going to create the code for the plateau.
Figure 4
Now we continue with the code of the Ball.
Figure 5
Now we're going to add a background.
Figure 6
Then we go back to the code of the ball.
Figure 7
Now you have created your own pong game. Did you enjoy making this game? You can also expand it! Add sound every time the ball bounces. Make the ball change color. Or keep score. You can customize this game completely to your own wishes. Have fun!