Scratch is a great platform for primary children to use to learn to code and for secondary children to hone their skills before moving to text based languages. There are lots of great games on Scratch, but in this festive season it is nice to make a game with a little code that everybody can enjoy, remix and share. The full game and code can be found at bit.ly/uked14dec04 To make your own game you will need two Sprites, an elf and a snowball. It is also nice to choose a festive background. You will also need to make three variables: aim, lives and speed. See the ‘Data’ column to make variables for all sprites.
- This code sets up the game and then handles the jump code. Point out to students that ‘forever’ is repetition.
- The second block of code enables the Sprite to duck. You will need two costumes for this. ‘elf2’ is the standing costume and ‘elf3’ is when he is ducked.
- You need code to handle the lives. It is important to ensure that the backdrop is setup at the beginning of the game and in many Scratch games you need a delay to ensure that lives are not taken off right at the beginning of the game. When lives reach 0 the game displays a Game Over backdrop.
- This code sets the start speed, decides randomly to aim high or low and then sends the snowball at the elf.
- This code makes the snowballs go faster and faster for an easier game you can make it wait longer for before getting faster.
The nice thing about these games is that you can easily extend the code to include sound effects, change backdrops after a certain time, time how long you can survive and give you points for every duck or jump you make! Every student can make something that they will enjoy playing!
James Abela @ESLweb has been working in IT since 1998, firstly in the industry and is now head of department in an all-through school in Thailand. He is passionate about getting children to learn to code because it improves their understanding of the digital world and helps them to think both logically and creatively. Read his blog at jamesabela.co.uk