Make a Battle Game in Scratch: Build “007” (Charge, Shield, Fire) in 10 Missions

Let’s build your very own battle game in Scratch! If you finish the 10 missions on this page in order, you’ll end up with a working game called “007” (Charge, Shield, Fire) — the hand-battle game lots of kids play in the playground. In each mission you’ll learn one new “magic word” (a coding idea) and add one piece to the game. It’s totally okay if things don’t work the first time — that happens to everyone. Take it slow, and ask a grown-up for help on the tricky bits.

What game are we making?

“007” is a duel where you save up power, then choose to attack or defend — a bit like rock-paper-scissors.

  • Charge — your power goes up by 1.
  • Fire — spend 1 power to attack the other player.
  • Shield — block the other player’s attack.
  • If you Fire while the other player is Charging, you win!

Before you start

  • Open Scratch on a computer (scratch.mit.edu). It’s free.
  • Click “Create” to open the screen where you snap blocks together.
  • Drag the coloured blocks from the left into the middle, and join them top to bottom.
  • The green flag starts your game. Save often with File → Save.

How to use this page

Every mission has the same 4 steps. Once you know the pattern, you can do it on your own.

  1. Learn this — the new coding idea for today.
  2. Build it — which blocks to join, step by step.
  3. Did it work? — check that it runs.
  4. Try this — a challenge to change it your way.

Mission 1: Set the stage (variables)

Learn this: A “variable” is a box that remembers a number. We’ll use it to count your “power”.

Build it:

  1. Have 2 sprites: “You” (the cat) on the left, “Enemy” (any sprite you like) on the right.
  2. In “Variables”, click “Make a Variable” and create “myPower”.
  3. Add “when green flag clicked”“set myPower to 0”.
  4. Tick the box next to “myPower” so the number shows on screen.

Did it work? Click the flag — if you see “myPower 0” on screen, well done!

Try this: Make “enemyPower” the same way and set it to 0 (you’ll use it later).

Mission 2: Make the Charge button (click)

Learn this: “when this sprite clicked” runs blocks only when you click that button. This is how buttons work.

Build it:

  1. Make a new sprite: draw a rectangle and write “Charge” on it (this is a button).
  2. On the Charge button, add “when this sprite clicked”.
  3. Underneath, join “change myPower by 1”.

Did it work? Each time you click Charge, myPower should go up by 1. Nice!

Try this: Design the button — change its colour and text however you like.

Mission 3: Call the referee (messages)

Learn this: A “message” (broadcast) sends a signal from one sprite to another. We’ll use it to call the “referee” who decides who wins.

Build it:

  1. Under the Charge button, add “broadcast battle” (make a new message called “battle”).
  2. On the cat (the referee), add “when I receive battle” → “say Battle! for 1 second”.

Did it work? When you click Charge, the cat should say “Battle!” Great!

Try this: Change what the referee says to your own words.

Mission 4: Remember which move you chose (text variables)

Learn this: A variable can hold words, not just numbers. We’ll use it to remember which button you pressed.

Build it:

  1. Make a variable called “myMove”.
  2. On the Charge button, before “broadcast battle”, add “set myMove to Charge”.

Did it work? When you click Charge, “myMove” should become “Charge” (check it on screen).

Try this: Show “myMove” on screen and watch it change.

Mission 5: Make Fire and Shield (if-then)

Learn this: “if … then” runs blocks only when something is true. You can only Fire when you have power.

Build it:

  1. Make “Fire” and “Shield” buttons, just like Charge.
  2. Fire button: “when this sprite clicked” → “if <myPower > 0> then” containing “set myMove to Fire” → “change myPower by -1” → “broadcast battle”.
  3. Shield button: “set myMove to Shield” → “broadcast battle”.

Did it work? You can only Fire when you have power, and firing lowers myPower by 1. Well done!

Try this: If you press Fire with 0 power, make the game say “No power!”.

Mission 6: Choose the enemy’s move (random)

Learn this: “pick random” gives a random number. We’ll use it so the enemy’s move is a surprise.

Build it: On the cat (referee), in “when I receive battle”, keep going:

  1. In “Operators”, use “pick random 1 to 3” and store it in a variable called “dice”.
  2. “if dice = 1 then” → “set enemyMove to Charge”
  3. “if dice = 2 then” → “set enemyMove to Fire”
  4. “if dice = 3 then” → “set enemyMove to Shield”
  5. Important (you can’t fire with no power): at the end, add “if <enemyMove = Fire> then” and inside it “if <enemyPower = 0> then → set enemyMove to Charge” (an “if” inside an “if”). An enemy with 0 power can’t attack, so it charges instead. Without this, the enemy could fire with no power — that’s not fair!

Did it work? Every battle, “enemyMove” changes randomly.

Try this: Show “enemyMove” on screen and watch it change each round.

Mission 7: Count the enemy’s power too (review)

Learn this: Review time. Just like you, the enemy gains power when it charges and loses power when it fires.

Build it: On the referee, after the enemy’s move is chosen, keep going:

  1. “if enemyMove = Charge then” → “change enemyPower by 1”
  2. “if enemyMove = Fire then” → “change enemyPower by -1”

Did it work? When the enemy charges, “enemyPower” goes up.

Try this: — (next you’ll decide who wins!)

Mission 8: Decide who wins (and)

Learn this: “and” joins two conditions together (it’s in “Operators”). You can say “Fire AND enemy is Charging” — true only when both happen.

Build it: On the referee, keep going:

  1. “if <myMove = Fire> and <enemyMove = Charge> then” → “say You win! for 2 seconds”
  2. “if <enemyMove = Fire> and <myMove = Charge> then” → “say You lose… for 2 seconds”

Did it work? Fire while the enemy is charging and “You win!” appears. Awesome!

Try this: — (nearly done!)

Mission 9: Finish the game (stop all)

Learn this: “stop all” ends the game. We’ll keep battling round after round until someone wins.

Build it:

  1. After “You win!” and “You lose…”, add “stop all” to each.
  2. If it’s neither, just “say Go again! for 1 second” (the battle continues).
  3. Add a reset: on “when green flag clicked”, add “set myPower to 0”, “set enemyPower to 0”, “set myMove to (blank)”, “set enemyMove to (blank)”. Now you can start fresh every time.

Did it work? The battle continues until someone wins, then it stops. Press the flag to start fresh — your basic “007” is complete!

Try this: Make a variable “wins” and count how many times you can win.

Mission 10: Finish & show it off

Learn this: Showing your work to people is an important skill too. Explain your game in your own words.

Build it (final check):

  1. Press the green flag and test that everything works from the start.
  2. Add a title and a “how to play” note.
  3. Save, then click “Share” so others can play it.

Did it work? If a grown-up or a friend can play your game — you did it!

Try this: Power it up with the “Extra challenges” below — add a Beam and some sounds!

Extra challenges (advanced)

These are for experts. If you can do them, you’re a real game creator!

Challenge 1: Fire a special “Beam”

When your power reaches 5, you can fire a special “Beam” that goes right through the enemy’s Shield.

  1. Make a 4th button (sprite) called “Beam”.
  2. Only show it once power reaches 5. On the Beam button add “when green flag clicked” → “forever”, and inside put “if <myPower > 4> then ‘show’, else ‘hide'” (an if-then-else).
  3. On the Beam button add “when this sprite clicked” → “set myMove to Beam” → “change myPower by -5” → “broadcast battle”.
  4. At the very top of the win/lose part in Mission 8, add “if <myMove = Beam> then” → “say Beam win! for 2 seconds” → “stop all”. A Beam always wins, even against Shield or Charge.

Challenge 2: Add sounds and movement (costumes)

A sound when you attack, or a moving character, makes it feel like a real game.

  1. Add sound: in the “Sounds” tab (top left), pick a sound (e.g. “Zoop” or “Pop”). Then, on the Fire (or Beam) button’s click script, add “start sound …”.
  2. Make 2 poses: on your character sprite, open the “Costumes” tab and make a “normal” pose and an “attack” pose (duplicate a costume and change it a little — e.g. raise an arm).
  3. Animate it: when “You win!”, add “switch costume to attack” → “wait 1 second” → “switch costume to normal”.
  4. For a loss, you could make the enemy switch to a “knocked out” pose.

How to keep learning on your own

  • Look inside other projects: Scratch is full of games. Click “See inside” on one you like to see which blocks were used. Copying is a great shortcut to getting good.
  • Tutorials: Scratch has built-in video “Tutorials”. Try one when you’re stuck.
  • One mission a day: You don’t have to do it all at once — one a day means you finish in 10 days.

Finally

Once you clear all 10 missions, you’re a game creator who can build a battle game! The coolest skill of all is this: when something doesn’t work, you ask “why?” and fix it yourself. Coding is something you get better at by making mistakes. Show your game to your family and friends and play it together. Next, you can take on even bigger games!

コメントする