Full playable demo

Play the full demo

Use Left and Right Arrow to move. Dodge meteors to score, avoid collisions, and press R after game over to restart.

Playable result only — the source code stays hidden.

Mission 00 5 min

Mission 0: See What You’re Building

Play Meteor Dodge first. Move with the Left and Right Arrow keys, dodge the falling meteors, and see how score and lives change. Then you will work backwards from a few repeated circles to arrays, loops, objects and finally the full game.

What to notice

  • several meteors share the same kind of data
  • arrays let one variable hold many related values
  • a loop can process every array item
  • objects keep the x, y and speed for one meteor together
  • collision detection is built and tested separately before it costs lives
Build roadmap

What you’ll build, mission by mission

  1. 1
    Meteor positions

    Read four stored x-positions from an array by index.

  2. 2
    Array length

    Ask the list how many meteors it contains.

  3. 3
    Push a meteor

    Grow the array and read the new item.

  4. 4
    Loop the list

    Replace repeated drawing calls with one loop.

  5. 5
    One meteor object

    Group x, y and speed into one object.

  6. 6
    Array of objects

    Move several meteor objects with one loop.

  7. 7
    Recycle meteors

    Reset a meteor after it leaves the screen.

  8. 8
    Random respawn and score

    Respawn unpredictably and score successful dodges.

  9. 9
    Pilot the ship

    Reuse held-key movement in the new game.

  10. 10
    Detect collision

    Learn `dist()` and make a collision visible before adding damage.

  11. 11
    Lose a life

    Use the collision Boolean to remove one life safely.

  12. 12
    Finish Meteor Dodge

    End the round at zero lives and use the supplied restart flow.

Mission demoUse an Array to Store Meteor Positions

Finished result only — the answer code stays hidden.