Scratch is a fantastic program created by MIT in the USA. The best part is that Scratch is absolutely free! It uses drag and drop for the children to build their programs. No actual typing is required except when setting certain properties and variables. If your child is just beginning to learn how to code, I would highly recommend starting with Scratch. It teaches them problem solving and thinking logically.
It is designed for children aged 8 to 16.
I was lucky enough to be an assistant tutor with Code Rangers and one of the things they were teaching was how to make a table tennis/ pong game using scratch. I decided to do this too! My Pong Game. Please note that all credit to this game goes to Code Rangers.
If you press the “See Inside” button, you will be able to see all my sprites and my code.
1Step one. Creating the Background sprite
Before we do anything, our pong game needs a background. On the bottom right hand side, you will see “stage” with some icons. Choose the paintbrush which will allow you to paint a background.
This is my background
2Step two. Create the puk
On the bottom right hand corner, you will see the sprites section. Where it says “new sprite” click on the paintbrush.
You can draw your own puk or you can choose the costume icon and choose a ball from the sports section.
3Step Three. Add some code to the puk
Let’s make the puk bounce around the stage.
What my code says is that whenever the start flag is pressed, Make the puk go to the top left hand corner. Point itself at a 45 degree angle (being a circle you don’t really see this). Then on a loop, move 15 steps in the direction it is going (number of steps sets the speed). If it hits the edge, bounce off.
4Step Four. Add the paddles
Now that you are familiar with adding sprites, I won’t go in to much detail. It is better to play around and find your own way through. You can see my code by pressing “step inside”. If you click on each sprite, then click on scripts, you can see my code attached.
5Step Five. Add the Goal Posts
With the goal posts, I edited my background to have 2 different colours for the goals. The code detects if the puk touches that specific colour to determine whether it is in the goal or not.
The great thing about scratch is that since it is popular, there is a lot of help out there. Just google your issues and there is likely an answer. Get in there and start building a great game! If you feel flustered, just save your game and start an easier project and work your way up!
I will be creating more articles about teaching your kids how to code. I will be introducing you to other platforms that are out there! Happy coding.