Challenge: grow the shield game into a prize box: a blaster with limited ammo, a smart bomb, then a power-up of your own.
A mushroom in Mario, a power pellet in Pac-Man, a shield in a space shooter: each one is a variable that changes the rules for a while.
Your shield game from the last two lessons: catch a star and you get a shield for 5 seconds. Now a star becomes a prize box. You will add three prizes, one milestone each, with less help each time. Everything you need is from earlier lessons: true or false, counting down, and every sprite of a kind.
Make your prediction first. Help opens once you've locked it in.

let rock: Sprite = null
let star: Sprite = null
let shield = false
let shieldTime = 0
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
otherSprite.destroy()
if (shield) {
info.changeScoreBy(5)
} else {
info.changeLifeBy(-1)
}
})
sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
otherSprite.destroy()
shield = true
shieldTime = 5
scene.setBackgroundColor(8)
})
scene.setBackgroundColor(15)
let ship = sprites.create(img`
8 8 . . . . . .
8 9 9 9 9 . . .
8 9 1 1 9 9 9 9
8 9 9 9 9 . . .
8 8 . . . . . .
`, SpriteKind.Player)
ship.setPosition(20, 60)
controller.moveSprite(ship, 0, 100)
ship.setStayInScreen(true)
info.setLife(3)
game.onUpdateInterval(1000, function () {
rock = sprites.create(img`
. e e e .
e e d e e
e d e e e
. e e e .
`, SpriteKind.Enemy)
rock.setPosition(160, randint(10, 110))
rock.vx = -50
rock.setFlag(SpriteFlag.AutoDestroy, true)
info.changeScoreBy(1)
if (shield) {
shieldTime += -1
if (shieldTime == 0) {
shield = false
scene.setBackgroundColor(15)
}
}
})
game.onUpdateInterval(5000, function () {
star = sprites.create(img`
. . 5 . .
5 5 5 5 5
. 5 5 5 .
. 5 . 5 .
`, SpriteKind.Food)
star.setPosition(160, randint(10, 110))
star.vx = -30
star.setFlag(SpriteFlag.AutoDestroy, true)
})
Read the star overlap and the 1-second timer.
Catch a star, then another before the shield ends.

let rock: Sprite = null
let star: Sprite = null
let shield = false
let shieldTime = 0
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
otherSprite.destroy()
if (shield) {
info.changeScoreBy(5)
} else {
info.changeLifeBy(-1)
}
})
sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
otherSprite.destroy()
shield = true
shieldTime = 5
scene.setBackgroundColor(8)
})
scene.setBackgroundColor(15)
let ship = sprites.create(img`
8 8 . . . . . .
8 9 9 9 9 . . .
8 9 1 1 9 9 9 9
8 9 9 9 9 . . .
8 8 . . . . . .
`, SpriteKind.Player)
ship.setPosition(20, 60)
controller.moveSprite(ship, 0, 100)
ship.setStayInScreen(true)
info.setLife(3)
game.onUpdateInterval(1000, function () {
rock = sprites.create(img`
. e e e .
e e d e e
e d e e e
. e e e .
`, SpriteKind.Enemy)
rock.setPosition(160, randint(10, 110))
rock.vx = -50
rock.setFlag(SpriteFlag.AutoDestroy, true)
info.changeScoreBy(1)
if (shield) {
shieldTime += -1
if (shieldTime == 0) {
shield = false
scene.setBackgroundColor(15)
}
}
})
game.onUpdateInterval(5000, function () {
star = sprites.create(img`
. . 5 . .
5 5 5 5 5
. 5 5 5 .
. 5 . 5 .
`, SpriteKind.Food)
star.setPosition(160, randint(10, 110))
star.vx = -30
star.setFlag(SpriteFlag.AutoDestroy, true)
})

let rock: Sprite = null
let star: Sprite = null
let shield = false
let shieldTime = 0
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
otherSprite.destroy()
if (shield) {
info.changeScoreBy(5)
} else {
info.changeLifeBy(-1)
}
})
sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
otherSprite.destroy()
shield = true
shieldTime = 5
scene.setBackgroundColor(8)
})
scene.setBackgroundColor(15)
let ship = sprites.create(img`
8 8 . . . . . .
8 9 9 9 9 . . .
8 9 1 1 9 9 9 9
8 9 9 9 9 . . .
8 8 . . . . . .
`, SpriteKind.Player)
ship.setPosition(20, 60)
controller.moveSprite(ship, 0, 100)
ship.setStayInScreen(true)
info.setLife(3)
game.onUpdateInterval(1000, function () {
rock = sprites.create(img`
. e e e .
e e d e e
e d e e e
. e e e .
`, SpriteKind.Enemy)
rock.setPosition(160, randint(10, 110))
rock.vx = -50
rock.setFlag(SpriteFlag.AutoDestroy, true)
info.changeScoreBy(1)
if (shield) {
shieldTime += -1
if (shieldTime == 0) {
shield = false
scene.setBackgroundColor(15)
}
}
})
game.onUpdateInterval(5000, function () {
star = sprites.create(img`
. . 5 . .
5 5 5 5 5
. 5 5 5 .
. 5 . 5 .
`, SpriteKind.Food)
star.setPosition(160, randint(10, 110))
star.vx = -30
star.setFlag(SpriteFlag.AutoDestroy, true)
})
Sort the jobs.

let shield = false
let shieldTime = 0
if (shieldTime == 0) {
shield = false
scene.setBackgroundColor(15)
}
Who decides each thing: Arcade's engine, or a game rule in your blocks? Match them.
Now a star gives a random prize: prize is 0 (the shield) or 1 (the blaster, still empty).
ammo to 5.ammo.In the else of the star overlap: set ammo to 5. Then add on A button pressed with if ammo > 0.
Inside the if: projectile from ship with vx 100, vy 0, then change ammo by -1. A Projectile–Enemy overlap destroys both and adds points.
A star sometimes refills the ammo; A fires only while there is ammo, and each shot uses one.
This ticks by itself when your blocks do what is asked.
Add a third prize: a smart bomb that destroys every rock on the screen, a point for each.
Change prize to pick random 0 to 2, and turn the else into else if prize = 1 (the blaster). The new else is the bomb.
In the bomb: for element value of array of sprites of kind Enemy, destroy value and change score by 1.
A third prize, a smart bomb, destroys every rock on the screen and scores for each.
This ticks by itself when your blocks do what is asked.
Design a fourth power-up and add it to the prizes:
Pick random 0 to 3, and one more else if. The last else is yours.
Ideas: an extra life, a slow-down (a variable the rock timer uses for vx), or a magnet that makes stars follow the ship.
A star gives one of four prizes, and the fourth is a power-up you designed.
This ticks by itself when your blocks do what is asked.
Challenge: students grow the shield game into a prize box with a blaster that runs out, a smart bomb that uses every sprite of a kind, and a power-up of their own design. About 60 minutes.
Open the teacher guide: answers, solutions, slides and a worksheet.
Nothing new: the challenge combines true or false (the shield), counting down (shieldTime, ammo) and every sprite of a kind (the smart bomb). A power-up is always three parts: a variable that remembers it, an event that changes it, and a rule that uses it. The Investigate match starts a thread for the next lesson: the engine (velocity, overlaps noticed, game over at zero lives, auto destroy) does the same jobs in every game, while game rules are the blocks you write.
Holding several power-ups in one program. Ask students to point at the variable, the event and the rule for each prize.
Stretch: Show the ammo on screen with the ship's say block after each shot.
Support: A student who finishes Milestone 1 has the key idea. For Milestone 3, offer the extra life (change life by 1) as a first power-up, then ask for one more of their own.
Next: Will it work in Arcade?, judging which games Arcade does well by the building blocks they need. Class ideas: a power-up design jam where pairs swap power-ups and rate them for fairness; draw a power-up card (name, variable, event, rule, how long).