Week 3 · Lesson 2 · 55 minutes

Add danger and test losing

I can make one enemy hit remove one life and explain the touched sprite.

Planned lesson. Follow your teacher’s teaching order.

Task steps and checks

Make an enemy appear

  1. Outside on start, use on game update every 1500 ms. Create kind Enemy at x 150 and random y 20 to 110. Set vx to −35, vy to 0 and auto destroy ON. vx is horizontal speed: negative means left. Auto destroy removes an enemy when it leaves the screen. See block reference 3, p25.

Use the enemy you touched

  1. Add Player overlaps Enemy outside on start. Inside the event, first destroy otherSprite, then change life by −1. otherSprite means the enemy just touched. A variable called enemy may point to a different, newer enemy.
Follow the arrows
  1. Player touches Enemy
  2. Destroy touched enemy
  3. Life −1
  4. Life zero?
  5. LOSE

Check for a loss

  1. After taking one life, if life ≤ 0, end with LOSE. Example only: life 1 → one hit → life 0 → LOSE. If one contact takes too many lives or the wrong enemy disappears, check which sprite your block destroys.

Try each path

  1. On page 8, record one hit, losing, and a new game from restart. Check that you can still win. Record actual observations; if you did not run a check, write NOT TESTED.

Show your code

  1. Draw or attach one block group. Label what starts it and what it changes. Write a real change to the code or plan, or say what you checked that showed no change was needed.

Ready check

Check your result: Save a new editable project PNG. In Home → Import, open it, check the blocks and run the game. A screenshot cannot be imported as a project. Keep both backups and explain why otherSprite matters.

Revised weekly handout pages: 8.

Materials

Individual student workbook · Computer with MakeCode Arcade Blocks and simulator · Individual saved project PNG and backup folder · Block reference 3, workbook page 25

Resources

Vocabulary

bug
A mistake that stops code doing what I intend.
interval
The time between repeated events.

See it

One enemy hit removes one lifeScreen: 160 × 120PlayerEnemyvx −35random y 20 to 110every 1500 ms: create EnemyPlayer overlaps Enemydestroy otherSpritechange life by −1life ≤ 0: game over LOSE
A new Enemy appears every 1500 ms and moves left. In the overlap event, otherSprite is the enemy that was really touched, so destroy that one before you change life.

Watch

Watch how an enemy is created and made to move. Compare it with Block reference 3 before you build your own.

MakeCode Arcade Tutorial 4: EnemiesYouTube

Open on YouTube

The video is on YouTube, which needs a VPN on most networks in mainland China. It is extra: the lesson works without it.

More examples and practice

Create a repeated challenge · 10 minutes

Outside on start, add on game update every 1500 ms. Create enemy of kind Enemy at x 150, random y 20 to 110. Give it vx -35, vy 0 and auto destroy ON. Negative x velocity moves left; auto destroy removes it after it leaves the screen.

Use Block reference 3 and predict the movement.

Handle one hit · 20 minutes

Add Player overlaps Enemy outside on start. First destroy the event’s otherSprite, then change life by -1, then if life <= 0 game over LOSE. otherSprite is the actual touched enemy; the variable enemy may refer to a newer enemy elsewhere.

Add the event in your own project and test a single hit.

Practice only: life is 3. An Enemy touches the Player. Which object should be destroyed, and what is the new life value?

Reveal reasoning

Destroy otherSprite from this Player–Enemy event: it is the touched enemy. Change life by -1: 3 becomes 2. Removing the touched enemy prevents repeated hits from the same overlap.

Practice only: life is 1 before a hit. After change life by -1, is life <= 0 true?

Reveal reasoning

Yes. Life is 0 and the lose condition is true. This is an expected behavior to test, not a claim that your project passed.

Check every path · 10 minutes

Expected checks are one hit, loss at zero lives, fresh restart and a win. Test each separately. If the wrong enemy disappears, check the event parameter before changing other code.

Complete page 8 checks with actual results. Fix one error at a time.

Practice

  1. Trace one hit using event labels before running code.
  2. Finish page 8 checks, labelled block group, honest change note and a verified backup.

Show your technical work · 9 minutes

A labelled screenshot or drawing should identify the trigger and state change, not just show a large screen of blocks. Record only real changes to code or plan; explain checks if no change was needed.

Label one block group and write your change/no-change note.

Verify the backup · 4 minutes

Save a new project PNG, then use Home → Import to open that file and check its blocks and game. A normal screenshot cannot do this.

Save/import and retain the earlier version.

Explain independently · 2 minutes

Your explanation shows what you understand. A tester may describe a problem but should not write your code for you.

Explain one event without a partner answering for you.

Explain why otherSprite is safer than the global enemy variable in the hit event.

Classwork evidence

Pages 7 and 8 are for class. The only assigned homework is the Week 2 planning on pages 5 and 6. Open Grade 7 homework →

Record what you actually tested in class. If you did not run a check, write NOT TESTED.

  1. Page 7: record what really happened in the pickup, win and restart checks.
  2. Page 8: record what really happened in the hit, lose and new-game checks.
  3. Page 8: label one block group. Explain one real change you made, or why you made no change.
  4. Keep both project backups.

You are finished when: All six checks have real observations and both backups are saved.

Why this matters: A first playable game gives real players something to test in Week 4.

Revised weekly handout pages: 7, 8.

Classwork guide (Word)

Week 3 feedback rubric

Task-specific feedback guide, not official IB descriptors or an automatic criterion grade.

Working core
Pickup, score, win, hit, life, loss and restart checks show expected and actual behavior.
Coding explanation
A labelled block group identifies its event and state change; the student can explain their own work.
Plan and versions
The student checks the plan, records real changes or a supported no-change note, and keeps editable backups.
BandObservable evidence
0The work does not yet show the building evidence described below.
1–2A few blocks or screenshots are present, but the core is mostly incomplete. Checks and explanations give little information about what happened.
3–4Some core behavior works. Some pickup, ending or restart checks are recorded. The student explains part of a block group and identifies a next step, but evidence or backups have gaps.
5–6The main start/play/end paths work, with actual check results. The student explains an event and state change, uses the plan, records real changes and saves usable versions.
7–8The core works as intended through pickup, hit, both endings and restart. Specific checks and debugging explanations show independent understanding. Plan decisions are explained and versioned editable backups are verified by importing.