All examples · Physics · As Markdown, for AIs

Space rocks

What this example shows

Space, the old way: nothing falls, and what leaves by one edge comes back by the other (bounds: 'wrap', the world's edges being the screen when it gives none). onBounds says when.

The ship turns its picture with angularVelocity (a retro collider never turns, its square stays square), thrusts with acceleration the way it faces, and is held to one top speed whichever way it goes (maxSpeed: 170). Shots leave the way it faces with setVelocityFromAngle. Rocks pass through each other, because their layer does not meet itself. Left and right to turn, up to thrust, Space or Z to fire.

Starting
Starting
—