07.4
Tank Battle
Five-stage 2D tank battle in the site's blue-glow palette · keyboard or touch · vector tanks · enemy AI · particle FX. back to widgets
$tanks --campaign --stage 01 / 05
>5 enemies queued · ai = wanderShoot
objective
Defend the ★ base and wipe out every enemy that spawns. Bricks are destructible · steel is not · bushes hide line of sight · water blocks tanks but bullets fly across. Five stages, three enemy AI flavours and a boss on the final stage. Lives reset to 3 at the start of each stage. Pick up S·shield · 2X·spread · RF·rapid-fire · +1·heal · F·base-fortify (steel walls for 16 s) — they drop from kills and also spawn periodically on the map.lvl01 / 05
lives
kills00 / 05
enemies0
baseintact
time00:00
// stage 01 of 05
Open Field
5 enemies · cap 2 on field · ai wanderShoot
press SPACE to deploy · P to pause
moveW A S D
move (alt)Arrows
fireSPACE
pauseP
// implementation — single mutable World object owned by a ref · swept-AABB tank/tile collision · ray-traced bullet/tile (no tunneling) · pure-function AI · particle ring buffer · all entity removals queued to end-of-frame.
// note — the canvas is paused automatically when the tab is hidden or the window loses focus, so you never lose progress to a stray tab switch.