Playable result only — the source code stays hidden.
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
What you’ll build, mission by mission
- 1Meteor positions
Read four stored x-positions from an array by index.
- 2Array length
Ask the list how many meteors it contains.
- 3Push a meteor
Grow the array and read the new item.
- 4Loop the list
Replace repeated drawing calls with one loop.
- 5One meteor object
Group x, y and speed into one object.
- 6Array of objects
Move several meteor objects with one loop.
- 7Recycle meteors
Reset a meteor after it leaves the screen.
- 8Random respawn and score
Respawn unpredictably and score successful dodges.
- 9Pilot the ship
Reuse held-key movement in the new game.
- 10Detect collision
Learn `dist()` and make a collision visible before adding damage.
- 11Lose a life
Use the collision Boolean to remove one life safely.
- 12Finish Meteor Dodge
End the round at zero lives and use the supplied restart flow.