How to Flash Superhero Game in ScratchJr

Introduction

Welcome back, aspiring coders! In this fun and fast-paced tutorial, we’re going to teach your child how to create an exciting Flash Superhero Game in ScratchJr. The main character, Flash (a modified version of the Scratch Cat), has a super-fast metabolism, and it’s your job to feed him! Using control buttons to move Flash left and right at super-speed, your child will learn how to catch falling fruit before it hits the ground. This activity is a fantastic ScratchJr project to introduce advanced concepts like sequencing, simultaneous movement, and using messaging blocks to trigger events. Get ready to code a challenging game that will keep the kids busy!

The Video Embed

What You Need

To build the Feed Flash Catch Game, you will need the following sprites and settings:

  • Characters (Sprites):
    • Flash: The main character (a modified Scratch Cat).
    • Left Control Button: A simple square (or custom sprite) to move Flash left.
    • Right Control Button: A simple square (or custom sprite) to move Flash right.
    • Falling Items: At least three different fruit sprites (e.g., a Peach and two Apples).
  • Backgrounds:
    • A main game screen background.
    • A separate end-of-game screen background.
  • Specific Setup: Flash’s movement speed should be increased to make the game challenging, living up to his “Flash” name [00:54].

Step-by-Step Instructions

This game uses sequential programming to ensure the fruit falls one after the other. We use the Send Message and Receive Message blocks to trigger the next falling item once the previous one has been collected.

Step 1: Coding Flash’s Movement

Flash needs to move quickly and be able to respond to the control buttons. Place Flash at the bottom of the screen.

  1. Select the Flash sprite.
  2. The code for Flash is minimal as the movement logic is attached to the control buttons.
  3. Ensure the speed is set to a fast pace by adjusting the Speed block within the left and right movement sequences later on.

Step 2: Coding the Control Buttons

We’ll use two simple square sprites to act as a virtual joypad on the screen.

  1. Select the Left Control Button sprite.
  2. Create the code sequence: Start on Tap → Send Left Message (Choose a message colour, e.g., Purple). [Insert screenshot of Left Button code here]
  3. Select the Right Control Button sprite.
  4. Create the code sequence: Start on Tap → Send Right Message (Choose a different message colour, e.g., Red). [Insert screenshot of Right Button code here]
  5. Now go back to the Flash sprite to receive these messages:
    • Receive Purple Message → Move Left (Use a distance of 1) → Repeat Forever.
    • Receive Red Message → Move Right (Use a distance of 1) → Repeat Forever.
    • IMPORTANT: Ensure you place the Set Speed block before the Move blocks to make Flash move fast [00:54].

Step 3: Coding the First Falling Fruit (Peach)

This is the only fruit that starts automatically when the game begins.

  1. Select the first fruit sprite (e.g., Peach). Place it high up on the screen.
  2. Start the sequence: Start on Green Flag.
  3. Use the Go to Home block to reset the fruit’s position when the flag is tapped.
  4. The fruit needs to fall and then “roll” (move slightly back up) if missed. This is a complex movement sequence using Move DownWait, and Move Up blocks [01:07].
  5. Set the main action: Start on Bump (when Flash touches it) → Hide → Send Yellow Message [01:15]. [Insert screenshot of Peach code here]

Step 4: Coding the Second Falling Fruit (Apple 1)

This fruit is triggered sequentially after the first one is caught.

  1. Select the second fruit sprite (e.g., Apple 1).
  2. The sequence does not start on the Green Flag. Instead, it starts with Receive Yellow Message (the message sent by the Peach) [01:35].
  3. The rest of the falling and bouncing logic is similar to the Peach, but with slightly adjusted numbers to keep the game interesting [01:41].
  4. Set the final action: Start on Bump → Hide → Send Green Message [01:46]. [Insert screenshot of Apple 1 code here]

Step 5: Coding the Third Falling Fruit (Apple 2)

This final fruit triggers the end-of-game sequence.

  1. Select the third fruit sprite (e.g., Apple 2).
  2. Start the sequence with Receive Green Message (the message sent by Apple 1) [01:59].
  3. Recreate the falling/bouncing logic.
  4. Set the final action: Start on Bump → Hide → Go to Page (Select your designated end screen) [02:07]. [Insert screenshot of Apple 2 code here]

Step 6: The End Screen Celebration

Create a new page/screen for the finale. This page will only have the Flash sprite.

  1. Select the Flash sprite on the new page.
  2. Start the sequence: Start on Green Flag (or similar trigger).
  3. Add movement: Move Right to run across the screen [02:15].
  4. Add dialogue: Say “Great I’m still hungry it’s time for dessert.” [02:15].
  5. Finish with an animation, like a Jump block to show his excitement [02:54]. [Insert screenshot of End Screen code here]

Troubleshooting/Tips

  • Check the Message Colours: The most common mistake is forgetting which message colour triggers which fruit. Ensure the Send Yellow Message from the first fruit matches the Receive Yellow Message on the second fruit, and so on.
  • Adjusting Difficulty: If the game is too easy or too hard, adjust Flash’s speed in Step 2, or change the wait times in the falling logic (Steps 3-5) to alter the speed and bounce of the fruit.
  • Simultaneous Coding: The “rolling” effect of the fruit after it lands is achieved through simultaneous coding—a separate script running alongside the main falling script. This is how it looks like it bounces and rolls at the same time [01:20].

If you are interested in doing more coding with your children and pupils, please check out the other ScratchJr tutorials I have created.