This is an interactive canvas sandbox where you drop black holes, suns, lightning, tornadoes, and tidal waves onto a tiny alien world. Aliens, pets, hover cars, buildings, and other objects react to what you do.
You can also turn on auto-spawn to let the disasters arrive on their own, and rotate gravity to send everything sliding in a new direction.
How it works
The whole world lives in one game engine file that runs a fixed update-and-draw loop on a single canvas. The world holds many kinds of objects, including aliens, pets, hover cars, buildings, plants, rocks, asteroids, flying saucers, airplanes, clouds, blimps, satellites, and background particles. Each has its own update and draw logic, and a spatial grid keeps particle collisions cheap.
Gravity is a direction vector that every object feels, so setting it to up, down, left, or right, or rotating it, changes how the whole world falls. The five tools each act on that world differently:
- Black hole: pulls objects inward within a radius, grows in, then fades over its lifetime. The code also has a white hole that ejects objects it was given.
- Sun: a large heat source with a corona and flares that grows and fades, and sets objects near it on fire.
- Lightning: a branching bolt from the top of the screen to the click point that zaps objects nearby.
- Tornado: a funnel with swirling debris that pulls objects in and wanders slightly over its lifetime.
- Tidal wave: a wave that sweeps across the world from one side, chosen by which half of the canvas you click, and knocks objects along the ground.
The engine also adjusts to the screen. It sizes the canvas to its container, caps the pixel count for large displays, and drops some visual effects on big or low-density screens to keep the frame rate smooth.
Controls
- Click the canvas to place the selected tool.
- Keys
1to5select black hole, sun, lightning, tornado, and tidal wave, and the tool buttons do the same. Atoggles auto-spawn.- The arrow keys set gravity up, down, left, or right.
- Hold
TorRto rotate gravity counterclockwise or clockwise. On touch screens, hold the rotate buttons. - The Speed slider runs the simulation from 0.1× to 4×.
- Reset clears the world and starts it again.
Built with
React 19, TypeScript, and Vite for the page, with the simulation engine in JavaScript on canvas.
The source is on GitHub.