Last time you started your Space Shooter and got your spaceship moving. Quick recap: how did you stop the spaceship going off the screen?
Today you'll keep building at your device — adding asteroids, firing rockets, scoring points and losing lives. Open the project you saved earlier and we'll predict, build, run and fix as we go.
Open with the recap question about stopping the spaceship leaving the screen to reconnect with last time. Confirm everyone has reopened the project they saved earlier before moving on — a misnamed or unsaved project will stall a pair early. Support cue: have the project-opening steps ready to talk a student through.
Before anyone runs anything, look at what we're about to add and commit to a prediction: when a rocket hits an asteroid, what do you think will happen on screen? And when an asteroid hits your spaceship?
Say your prediction to your partner before you press run — we'll come back to it later.
Run the PRIMM predict beat: gather two or three predictions about what the collisions will do and park them on the board. Resist letting anyone run yet — the value is in committing first. Ask quieter students for their prediction to a partner if not to the room.
Welcome to the Space Shooter game creation lesson! In this exciting course, you will learn how to create your very own space-themed game using MakeCode Arcade. You will control a spaceship that needs to dodge and shoot asteroids. Ready to start your space adventure? Let's dive in!
A short orientation step — read the goal of the game aloud (dodge and shoot asteroids) so students hold the whole picture before building the parts. No code to model here; frame it as decomposition into pieces.
Go to the arcade.makecode.com website and create a new project.
Create a new Arcade project using the makecode.com website.
Most students already have their saved project open, so this is a quick check rather than a fresh start. If anyone genuinely needs a new project, point them to arcade.makecode.com and have them set up while others move ahead.
In this game you will control a spaceship that has to dodge and shoot asteroids that come flying at it.
Add the following code to create the spaceship sprite and use the sprite editor to design your spaceship. It should point towards the right as that's where the asteroids will be coming from.
Rename your sprite to spaceship.
let spaceship = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . d d d . . . . . . . .
. . 2 2 2 1 1 1 d d . . . . . .
. . 2 4 4 1 1 1 1 1 d d . . . .
. 2 4 4 5 1 1 1 1 1 1 1 d d . .
2 4 4 5 5 1 1 1 1 1 1 1 1 1 d d
2 2 4 4 5 1 1 1 1 1 1 1 d d . .
. 2 2 4 4 1 1 1 1 d d d . . . .
. . 2 2 2 d d d d . . . . . . .
. . . . 2 d d . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
`, 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 adding and renaming the spaceship sprite on the board. Key point: the sprite should face right, towards where asteroids appear. Watch for students who skip renaming to <em>spaceship</em> and then can't follow later steps. Support: let them copy the on-screen design rather than draw their own.
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.