Makecode Arcade
Beginner
40 mins
Teacher/Student led
+170 XP

Studio: Galaxy Ghosts

Students build Galaxy Ghosts in MakeCode Arcade step by step, adding a player, falling enemies with a speed variable, projectiles, scoring, a status bar and damage, then rebalance one value so the game feels hard but fair.

Teacher Class Feed

Load previous activity

    1 - Start: What We're Building ~4 mins

    Illustration for Start: what we're buildingToday you are coding in MakeCode Arcade. You will build Galaxy Ghosts at your device: a space shooter with falling ghosts, a speed variable, shots, score, a health bar and damage.

    You can already move sprites and run a project. Before you build, think: what might make the ghosts get harder as the game goes on?

    You will predict, build step by step, run, and fix as you go. Later you will change one number so the game feels hard but fair.

    2 - The Plan: Six Parts to Build ~2 mins

    Galaxy Ghosts has six parts:

    1. A player that moves left and right.
    2. Ghosts that appear at the top in random places and fall.
    3. A speed variable so you can change how fast they fall.
    4. Shots that hit them.
    5. A score for each hit.
    6. A health bar that takes damage and ends the game.

    Run it after every part.


    3 - Start a New Project ~2 mins

    Open the MakeCode Arcade website using the link below and create a new project. You can call the project whatever you want.

    https://arcade.makecode.com

    4 - Create Your Player ~2 mins

    First let's create our player sprite.

    Add the following code and choose the blue space ship sprite:

    let mySprite: Sprite = null
    mySprite = sprites.create(img`
        . . . . . . . c d . . . . . . . 
        . . . . . . . c d . . . . . . . 
        . . . . . . . c d . . . . . . . 
        . . . . . . . c b . . . . . . . 
        . . . . . . . f f . . . . . . . 
        . . . . . . . c 6 . . . . . . . 
        . . . . . . . f f . . . . . . . 
        . . . . . . . 8 6 . . . . . . . 
        . . . . . . 8 8 9 8 . . . . . . 
        . . . . . . 8 6 9 8 . . . . . . 
        . . . . . c c c 8 8 8 . . . . . 
        . . . . 8 8 6 6 6 9 8 8 . . . . 
        . . 8 f f f c c e e f f 8 8 . . 
        . 8 8 8 8 8 8 6 6 6 6 9 6 8 8 . 
        8 8 8 8 8 8 8 8 6 6 6 9 6 6 8 8 
        8 8 8 8 8 8 8 8 6 6 6 6 9 6 8 8 
        `, SpriteKind.Player)
    

    5 - Move Left and Right ~3 mins

    We want to position the player sprite at the bottom of the screen and use the joystick (or arrow keys on your keyboard) to move it left and right.

    Add the following new code:

    let mySprite: Sprite = null
    mySprite = sprites.create(img`
        . . . . . . . c d . . . . . . . 
        . . . . . . . c d . . . . . . . 
        . . . . . . . c d . . . . . . . 
        . . . . . . . c b . . . . . . . 
        . . . . . . . f f . . . . . . . 
        . . . . . . . c 6 . . . . . . . 
        . . . . . . . f f . . . . . . . 
        . . . . . . . 8 6 . . . . . . . 
        . . . . . . 8 8 9 8 . . . . . . 
        . . . . . . 8 6 9 8 . . . . . . 
        . . . . . c c c 8 8 8 . . . . . 
        . . . . 8 8 6 6 6 9 8 8 . . . . 
        . . 8 f f f c c e e f f 8 8 . . 
        . 8 8 8 8 8 8 6 6 6 6 9 6 8 8 . 
        8 8 8 8 8 8 8 8 6 6 6 9 6 6 8 8 
        8 8 8 8 8 8 8 8 6 6 6 6 9 6 8 8 
        `, SpriteKind.Player)
    mySprite.y = 110
    controller.moveSprite(mySprite, 100, 0)
    
    Make sure you select y in the position block and put in a value of 110. This will make the sprite go to the bottom.

    Click the + on the move block and have values of vx 100 and vy 0. This means we can move the sprite left and right (vx) but not up and down (vy).
    Once you've added the code check to see that your space ship is at the bottom and you can move it left and right.


    123learn · Online learning platform

    Unlock the full learning experience

    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.

    Hundreds of curriculum-aligned lessons
    Interactive activities in every lesson
    Printable resources & progress tracking
    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2025. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more