🚀 ASTEROIDS

Turn, thrust, shoot — and remember that space has no brakes

← Back to Fun Time
Score
0
Lives
3
Wave
1
Best
0

⌨️ Controls

  • turn the ship  •  fire the engine
  • SPACE shoot — up to four shots at once
  • Tapping the field shoots too
  • P pause  •  R new game
  • 🎮 Xbox controller? Just plug it in or pair it — the stick and D-pad are the arrow keys, A is SPACE, Menu pauses and View starts again

🎯 How to play

  • Turning points the ship. Thrust pushes it — and it keeps going.
  • To stop, turn all the way round and thrust against your own drift.
  • Fly off any edge and you come back on the other side.
  • The dashed ring means you cannot be hit for a moment. Use it to get clear.

🏆 Scoring

  • Big rock 20  •  medium 50  •  small 100.
  • Every rock you break makes two smaller, faster ones.
  • Clearing a whole wave is another 100.
  • Tip: break the big ones one at a time. Break them all at once and there will be sixteen little rocks after you.

🧑‍💻 For young coders: build this game yourself

This game is split into small library files inside funtime/lib/, and every function has a comment saying exactly what goes in, what comes out, and the algorithm in plain English. Empty any function out, read its comment, and write it yourself.

File What it does Good functions to try re-writing
lib/asteroids-rules.js The rules: angles, drifting, wrapping, breaking pointFrom, wrapPosition, thrustShip, hitRocks
lib/asteroids-draw.js Painting the ship and the lumpy rocks drawShip, drawRock, renderGame
lib/asteroids-main.js The glue: the held keys, the taps, the loop doAction, holdButton, gameLoop

💡 The big idea: cos and sin turn a direction into a place. Give them an angle and a distance and they tell you exactly where you end up. Learn that one function and you can point, aim, orbit and steer in any game you ever write.

🛠️ Want to be walked through it? Build Asteroids Yourself takes you through the key functions one step at a time and tests each one you write. There is a Python version too.