Programmers rarely get a game working perfectly the first time — a huge part of the job is testing, spotting when something goes wrong, and fixing it. That's called debugging, and today you'll do exactly what game developers do all day.
You'll reopen the platform game you saved last time and keep building it. Watch the board as each new piece is modelled, then add it on your own device and run it to see what happens. When something behaves unexpectedly, that's not a mistake — it's your next puzzle to solve.
Open by reminding pupils this is the next part of their ongoing project. Make sure every pair reopens the project they saved previously before anything else. Ask: 'What did we get working last time?' Model the first piece on the IWB before pupils touch their devices. Support cue: pair a confident pupil with one who needs help finding the saved file.
Platform games (often simplified as platformer or jump 'n' run games) are a video game genre of action games in which the goal is to move the player character between points in an environment. Platformers use in jumping and climbing to navigate the player's environment and reach their goal. Levels and environments feature uneven terrain and suspended platforms of varying height that requires use of the player character's abilities in order to traverse them.
Read this framing aloud to set the scene for the platform game genre. Ask pupils to name platform games they know so the goal — get the character from start to goal across platforms — feels concrete. No device work needed here; keep it brief.
Go to the arcade.makecode.com website and open the project you saved last time. Do not start a new one — today you are adding to the game you already built.
Create a new Arcade project using the makecode.com website.
Show on the IWB how to reach the site and reopen the saved project. Key question: 'Is everyone on arcade.makecode.com and not a different page?' Watch for pupils starting a brand-new project when they should be continuing the saved one — check they are in the right place.
In this game you will control a sprite and move it from the start of the map, to the goal at the end.
Add the following code to your project to create your sprite and use the sprite editor to design your character.
let mySprite = sprites.create(img`
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
5 5 5 f f 5 5 5 5 f f 5 5 5 5 5
5 5 5 f f 5 5 5 5 f f 5 5 5 5 5
5 5 5 f f 5 5 5 5 f f 5 5 5 5 5
5 5 5 f f f f 5 5 f f f f 5 5 5
5 5 5 f f f f 5 5 f f f f 5 5 5
5 5 5 f f f f 5 5 f f f f 5 5 5
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
5 f 5 5 5 5 5 5 5 5 5 5 5 f 5 5
5 f f 5 5 5 5 5 5 5 5 5 f f 5 5
5 5 f f f f f f f f f f f 5 5 5
5 5 f f f f f f f f f f 5 5 5 5
5 5 5 f f f f f f f f 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
`, SpriteKind.Player)
Click on the gray box in the sprite block to open the Editor. You can choose a sprite from the Gallery or you can paint your own sprite using the Editor.
Model creating the sprite and opening the sprite editor on the IWB. Encourage pupils to design their own character but not to spend the whole lesson decorating. Common issue: pupils lose the sprite editor — show how to reopen it. Extension: let fast finishers refine their sprite art later.
In the game we will use the left and right buttons to move our sprite.
Add the following new code:
let mySprite = sprites.create(img`
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
5 5 5 f f 5 5 5 5 f f 5 5 5 5 5
5 5 5 f f 5 5 5 5 f f 5 5 5 5 5
5 5 5 f f 5 5 5 5 f f 5 5 5 5 5
5 5 5 f f f f 5 5 f f f f 5 5 5
5 5 5 f f f f 5 5 f f f f 5 5 5
5 5 5 f f f f 5 5 f f f f 5 5 5
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
5 f 5 5 5 5 5 5 5 5 5 5 5 f 5 5
5 f f 5 5 5 5 5 5 5 5 5 f f 5 5
5 5 f f f f f f f f f f f 5 5 5
5 5 f f f f f f f f f f 5 5 5 5
5 5 5 f f f f f f f f 5 5 5 5 5
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
`, SpriteKind.Player)
controller.moveSprite(mySprite, 100, 0)
Model adding the left/right movement, then have pairs run it immediately to see the sprite move. Key question: 'Does your sprite respond to both buttons?' If it only moves one way, check both button pieces were added. Safety-free step — keep the run-test habit going.
You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.