Hello, coding friends! Ready for a sweet and speedy challenge? This tutorial shows you how to create a fantastic Gingerbread Man game—an ideal ScratchJr project for mastering full directional movement and implementing a game-ending countdown clock!
In this ScratchJr game, you’ll control a custom-designed Gingerbread Man who must race against a timer to collect as many Christmas trees as possible before time runs out!
Step 1: Design Your Gingerbread Man and Christmas Trees
We’ll start by custom-creating our main character and the collectibles.
- Create the Gingerbread Man: Start a new project, delete the cat, and use the paint editor to build your Gingerbread Man. Use circles and rectangles for the body, then add eyes, buttons, and a smiling face for character (
[00:00:21]). - Design Collectible Trees: Create your Christmas Tree sprite using multiple triangles for the foliage, a brown trunk, and colorful decorations (like red and yellow circles) (
[00:02:10]). Duplicate this tree multiple times and scatter them around the screen ([00:03:26]).
Step 2: Set Up Full Directional Controls
To navigate the screen and collect the trees, the Gingerbread Man needs full control.
- Create Joystick Buttons: Design four simple square sprites to act as a directional joystick: Up (blue), Down(green), Left (yellow), and Right (red) (
[00:03:44]). - Send Messages: Code each button to send its unique colour-coded message when tapped (
[00:04:31]). - Receive and Move: Go to the Gingerbread Man sprite and connect the messages to the corresponding movement blocks (
[00:04:52]):- Blue Message: Triggers the
move upblock ([00:05:04]). - Green Message: Triggers the
move downblock ([00:05:19]). - Yellow Message: Triggers the
move leftblock ([00:05:11]). - Red Message: Triggers the
move rightblock ([00:05:11]).
- Blue Message: Triggers the
Step 3: Coding the Collectibles and Timer
The two final, key mechanics are making the trees disappear and ensuring the game ends on time.
- Code the Tree Collection: On all Christmas Tree sprites, the code is simple: when the tree is touched by the Gingerbread Man (using the
bumpblock), it should immediatelyhideto simulate a successful collection ([00:05:27]). - The Countdown Clock: This is the element that drives the challenge!
- Create Timer Sprites: Create a new page (Page 2) for your winning screen (
[00:06:46]). On the main game screen, create a clock face (circular backdrop) and a simple arrow hand ([00:05:49]). - Code the Timer Logic: On the arrow sprite, use the
green flagstart block. Then, use therepeatblock set to 12 times. Inside the repeat, add theturn clockwiseblock and awaitblock set to 3 tenths of a second ([00:06:37]). - End Game Action: Once the 12 rotations are complete, use the
go to page 2block ([00:07:22]) to display your Win Screen, which should say “Merry Christmas.”
- Create Timer Sprites: Create a new page (Page 2) for your winning screen (
This full-featured ScratchJr project will test your player’s speed and coordination! See how many Christmas trees your Gingerbread Man can collect before the clock hand makes its final turn!
Ready for more seasonal coding fun? You can find a whole sleigh-load of exciting new Christmas coding projects to try next and don’t forget is you can click here to see yesterday’s Xmas ScratchJr Project.
Alternatively, if you are looking for Coding Tutor in Hertfordshire to support your children with this, I can also help.
Leave a comment