Loading

Loading sources… all files

    Overview

    Iain Lobb wrote EntityAsteroids in ActionScript 3, pairing a lightweight entity-component engine with an Asteroids-style space shooter built to demonstrate it.

    Created as the companion project for a two-part game development tutorial, the codebase illustrates why component composition is cleaner and more flexible than deep object-oriented inheritance hierarchies.

    Six entity classes drive the game: the main controller, your ship, splitting asteroids, bullets, the weapon component, and a roaming alien ship that fires in random directions. To win, clear every asteroid and destroy the alien saucer.

    Made by
    Iain Lobb
    Released
    2012

    Controls guide

    Flying

    KeyAction
    Left/RightRotate ship
    UpThrust forward
    DownReverse thrust / brake
    W/A/S/DAlternate movement and rotation keys
    Space/ZFire weapon (semi-automatic, one shot per press)

    Starting

    KeyAction
    ClickStart the game, or restart after winning or losing

    Cheatsheet

    Objects

    Your ship
    6 HP; destroyed on the sixth hit
    Asteroid
    10 spawn at the start; each hit shrinks the rock and splits off a clone, disappearing after its third split
    Enemy ship
    Drifts across the arena firing in random directions; takes 6 hits to destroy
    Bullet
    Expires after roughly one second of flight
    Collision
    Colliding with an asteroid destroys that rock completely at the cost of 1 ship HP

    Rules

    Win
    Eliminate all asteroids and the alien ship
    Lose
    Lose all 6 HP
    Screen edges
    Ships, asteroids, and bullets wrap around all four screen borders

    Tips

    1. Fully clearing a single large asteroid takes 7 shots (1 large, 2 medium, 4 small), meaning the 10 starting boulders require 70 total hits. Because there is no autofire, tap Space or Z rhythmically instead of holding it.
    2. Ramming a large asteroid deletes it outright without splitting it into smaller fragments, costing just 1 of your 6 HP—a handy shortcut when you have health to spare.
    3. Asteroids do not damage the alien ship, and only its stray bullets can hurt you from afar, so keep your distance from the saucer while thinning out the rocks.
    4. Your ship has rotational inertia and light velocity drag, so start turning early and use Down to brake.