Keep what changes from level to level in a list, and look it up with the level as the place, counted from 0.
Faster ghosts, a new colour, more aliens: each level is a row in a table. A list is one column of that table.
Last lesson the level was one number. Now each level has its own speed. A list (in Arrays) holds them in order: speeds is 40, 70, 100. get value at looks one up by its place: speeds[level].
Places in a list are counted from 0. So the level now starts at 0, and the splash shows level + 1, because players count from 1. destroy all sprites of kind (Sprites) clears the old level's enemy.
Make your prediction first. Help opens once you've locked it in.

let enemy: Sprite = null
let speeds = [40, 70, 100]
let level = 0
let goal = 5
function startLevel () {
sprites.destroyAllSpritesOfKind(SpriteKind.Enemy)
game.splash("Level " + (level + 1))
enemy = sprites.create(img`
a . . a
a a a a
a 1 1 a
a a a a
`, SpriteKind.Enemy)
enemy.setPosition(80, 10)
enemy.setVelocity(speeds[level], speeds[level])
enemy.setBounceOnWall(true)
}
let player = sprites.create(img`
. 4 4 .
4 4 4 4
. 8 8 .
. 8 8 .
`, SpriteKind.Player)
controller.moveSprite(player)
player.setStayInScreen(true)
let coin = sprites.create(img`
. 5 5 .
5 5 4 5
5 4 5 5
. 5 5 .
`, SpriteKind.Food)
coin.setPosition(randint(10, 150), randint(10, 110))
info.setLife(3)
startLevel()
sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
otherSprite.setPosition(randint(10, 150), randint(10, 110))
info.changeScoreBy(1)
if (info.score() >= goal) {
level += 1
goal += 5
if (level == 3) {
game.gameOver(true)
} else {
startLevel()
}
}
})
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
info.changeLifeBy(-1)
otherSprite.setPosition(80, 10)
})
Read startLevel, then the Player–Food overlap.
Collect coins and dodge the purple enemy. Press A (space) to close each splash. Can you win?

let enemy: Sprite = null
let speeds = [40, 70, 100]
let level = 0
let goal = 5
function startLevel () {
sprites.destroyAllSpritesOfKind(SpriteKind.Enemy)
game.splash("Level " + (level + 1))
enemy = sprites.create(img`
a . . a
a a a a
a 1 1 a
a a a a
`, SpriteKind.Enemy)
enemy.setPosition(80, 10)
enemy.setVelocity(speeds[level], speeds[level])
enemy.setBounceOnWall(true)
}
let player = sprites.create(img`
. 4 4 .
4 4 4 4
. 8 8 .
. 8 8 .
`, SpriteKind.Player)
controller.moveSprite(player)
player.setStayInScreen(true)
let coin = sprites.create(img`
. 5 5 .
5 5 4 5
5 4 5 5
. 5 5 .
`, SpriteKind.Food)
coin.setPosition(randint(10, 150), randint(10, 110))
info.setLife(3)
startLevel()
sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
otherSprite.setPosition(randint(10, 150), randint(10, 110))
info.changeScoreBy(1)
if (info.score() >= goal) {
level += 1
goal += 5
if (level == 3) {
game.gameOver(true)
} else {
startLevel()
}
}
})
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
info.changeLifeBy(-1)
otherSprite.setPosition(80, 10)
})

let enemy: Sprite = null
let speeds = [40, 70, 100]
let level = 0
let goal = 5
function startLevel () {
sprites.destroyAllSpritesOfKind(SpriteKind.Enemy)
game.splash("Level " + (level + 1))
enemy = sprites.create(img`
a . . a
a a a a
a 1 1 a
a a a a
`, SpriteKind.Enemy)
enemy.setPosition(80, 10)
enemy.setVelocity(speeds[level], speeds[level])
enemy.setBounceOnWall(true)
}
let player = sprites.create(img`
. 4 4 .
4 4 4 4
. 8 8 .
. 8 8 .
`, SpriteKind.Player)
controller.moveSprite(player)
player.setStayInScreen(true)
let coin = sprites.create(img`
. 5 5 .
5 5 4 5
5 4 5 5
. 5 5 .
`, SpriteKind.Food)
coin.setPosition(randint(10, 150), randint(10, 110))
info.setLife(3)
startLevel()
sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
otherSprite.setPosition(randint(10, 150), randint(10, 110))
info.changeScoreBy(1)
if (info.score() >= goal) {
level += 1
goal += 5
if (level == 3) {
game.gameOver(true)
} else {
startLevel()
}
}
})
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
info.changeLifeBy(-1)
otherSprite.setPosition(80, 10)
})
Work out each level from the list.
Match each block with its job.
speeds is 40, 70, 100. Fill in what startLevel does at each level.
| level | splash shows Level … | enemy speed |
|---|---|---|
| 0 | 1 | |
| 1 | ||
| 2 |
Match each block in this game with its job.
Give each level its own background colour, from a new list. Set it in startLevel.
Make a new list, colours, with three numbers, in on start. Arrays has the list block.
In startLevel: set background color to (get value at level from colours).
Add a fourth level with the fastest enemy yet. What else must change?
Add a fourth speed to the list.
The win now comes at level 4.
Each level has its own background colour, set in startLevel from a list.
This ticks by itself when your blocks do what is asked.
A fourth level: a fourth speed, and the win moved.
This ticks by itself when your blocks do what is asked.
goal starts at 4, and each level-up changes goal by 4. At what score does the third level-up happen?
This dodger scores a point for every rock. Give it three levels:
In on start: a list of three rock speeds (negative, they fly left), a list of three colours, and a goal of 10. Call startLevel.
startLevel: destroy all Enemy sprites, set the background from the colours list, splash the level.
In the timer, set rock vx to the speed for this level. After change score: if score ≥ goal, change level by 1, change goal by 10, then if level = 3 game over (win), else startLevel.
Three levels, each with its own background colour and rock speed, started by startLevel, and a win after level 3.
This ticks by itself when your blocks do what is asked.
Catch fish with the net. Every 5 fish the water gets deeper and the fish swim faster. Add a fourth level (both lists need a fourth item, and the win must move), then make the deepest level's fish the fastest yet.
Students keep per-level settings in lists, look them up with the level as the place (counted from 0), start each level with a startLevel function, and build a three-level dodger with a win. About 50 minutes.
Open the teacher guide: answers, solutions, slides and a worksheet.
A list such as speeds (40, 70, 100) holds what changes per level; speeds[level] (get value at) looks up the value at that place, counted from 0, so level 0 uses 40. That is why the level now starts at 0 (last lesson it started at 1), and the splash shows level + 1 with join, labelled copy-for-now.
A function startLevel sets up a level: destroy all sprites of kind Enemy clears the old one, a splash, and a new enemy at speeds[level]. The win checks level = 3 before startLevel, since a list of 3 has no place 3.
The Make is the biggest program so far (about 25 blocks): try it yourself first.
Places start at 0. When a level is off by one, ask which place the list starts at.
Stretch: Add a third list, the number of enemies per level, and call your function from B3 that many times.
Support: Give students the Make game with the lists and startLevel already made, so they add only the level-up and the win.
Next unit: power-ups, with true or false and things that run out. Skillmap: Jungle Jump Platformer (arcade.makecode.com/skillmaps) builds a level per map. Class idea: design a level table on paper (speed, colour, enemies, goal) before coding it.