Introduction
In this exciting tutorial, we are going to build an action-packed game where the mighty Thor battles against the Ice Giants! This is a fantastic ScratchJr project for children who want to learn about creating custom characters, using message blocks for controls, and building a working countdown timer. The goal of the game is simple but fun: guide Thor to defeat all the Ice Giants before the time runs out. By following this guide, you will master important ScratchJr coding concepts like sending messages, loops, and collision detection. Let’s grab our hammers and get coding!
The Video Embed
What You Need
To build this game, you will need to prepare a few specific characters and backgrounds. You can draw these using the paint editor:
- Thor: Adapt a standard character (like the “child” or “person”) and give them a helmet and hammer.
- Ice Giants: Create multiple copies of a person character and use the paint bucket to colour them entirely blue.
- The Clock: A simple circle for the face and a separate character for the hand (an arrow made from a rectangle and triangle).
- The Controller: Four separate square characters coloured Orange, Red, Yellow, and Green.
- A Victory Page: A second page (Scene 2) for when the player wins.
Step-by-Step Instructions
Step 1: Creating the Controller
We need a way to move Thor. Instead of tapping Thor directly, we will use four coloured squares as buttons (a ‘joypad’).
- Create four square characters: Orange, Red, Yellow, and Green.
- For each square, use the Start on Tap block.
- Connect a Send Message block to each one, ensuring the message colour matches the square (e.g., the Orange square sends an Orange message).
- [Insert screenshot of the coloured squares setup here]
Step 2: Coding Thor
Thor needs to listen to the controller.
- Select your Thor character.
- Add four separate scripts, each starting with a Start on Message block (Orange, Red, Yellow, and Green).
- Add movement blocks to each script. For example:
- Orange Message: Move Up.
- Red Message: Move Down.
- Yellow Message: Move Left.
- Green Message: Move Right.
- [Insert screenshot of Thor’s message scripts here]
Step 3: The Countdown Timer
The clock adds urgency to the game. We will code the arrow to rotate like a real clock hand.
- Select the Arrow character.
- Start with a Start on Green Flag block.
- Add a Repeat loop set to 12 (representing the hours on a clock).
- Inside the loop, place a Turn Right block (set to 1) and a Wait block (to control the speed).
- After the loop finishes, add a Go to Page 2 block to trigger the victory screen.
- [Insert screenshot of the clock arrow code here]
Step 4: The Ice Giants
These are the enemies Thor must defeat.
- Place your Ice Giants around the screen.
- Movement: You can give them simple movement scripts or have them appear and disappear using Hide and Show blocks with different Wait times to make them tricky to catch.
- Defeat: Add a script starting with Start on Bump. Connect a Stop or Disappear block. This ensures that when Thor touches them, they are defeated.
- [Insert screenshot of an Ice Giant’s code here]
Step 5: The Victory Screen
Finally, set up the screen that appears when the time runs out or the level is complete.
- On Page 2, place Thor in the centre.
- Add a script: Start on Green Flag -> Say “Victory!” -> Move Right -> Move Left.
- Add a Repeat Forever loop if you want him to celebrate continuously.
Troubleshooting/Tips
- Ice Giants Standing Up: If you rotate your Ice Giants using code, they might reset to an upright position when the game restarts. To fix this, rotate them inside the Paint Editor so they are permanently angled.
- Giants Disappearing Early: Be careful where you place your Ice Giants. If they touch each other and have a “Start on Bump” script, they might defeat themselves! Space them out so they don’t overlap.
- If you are interested in doing more coding with your children and pupils, please check out the other ScratchJr tutorials I have created.