A casual arcade stacking game built with vanilla HTML5 Canvas. A block swings from a crane โ tap to drop it onto the tower. Overhang gets cut off, making precision crucial. Features adaptive AI difficulty, procedural building skins, background music, and sound effects.
- Tap / Click / Space to start the game
- Watch the block swing from the crane
- Tap / Click / Space to release the block
- Land it on the tower as precisely as possible
- Overhang gets cut off โ the tower narrows with each miss
- Perfect landing (>95% overlap) earns bonus points and combo multipliers
- Game ends when you miss the tower completely
- Swinging crane mechanics โ block swings on a rope pendulum
- Adaptive difficulty โ game gets harder as you improve, eases off when you struggle
- Procedural building skins โ each floor has unique colors, windows, doors, and decorations
- Combo system โ consecutive perfect landings multiply your score (Nice! / Amazing! / Legendary!)
- Score popups โ floating "+N" text on each landing
- Background music โ cheerful procedural melody (~40s loop) with bass line
- Sound effects โ landing, perfect, combo milestone, game over
- Mute toggle โ click icon or press M, persists across sessions
- Smooth camera โ parallax clouds and auto-scrolling as your tower grows
- Best score โ saved locally, persists across sessions
| Input | Action |
|---|---|
| Click / Tap | Drop block / Start / Retry |
| Space | Drop block / Start / Retry |
| M | Toggle mute |
| Mute icon (top-right) | Toggle mute |
The game uses ES modules, which require a server in most browsers.
Using Node.js:
npx serve stack-tower-gameThen open http://localhost:3000 in your browser.
Using Python:
cd stack-tower-game
python -m http.server 8080Then open http://localhost:8080 in your browser.
- Install the Live Server extension
- Right-click
index.htmlโ Open with Live Server
stack-tower-game/
โโโ index.html # Entry point
โโโ css/
โ โโโ style.css # Responsive layout
โโโ js/
โโโ main.js # Init, events, game loop
โโโ game.js # State machine, scoring, combos
โโโ block.js # Swing, drop, landing mechanics
โโโ tower.js # Block stack + camera scrolling
โโโ renderer.js # All Canvas drawing
โโโ ai.js # Difficulty scaling + procedural skins
โโโ audio.js # Web Audio API synthesis (BGM + SFX)
โโโ utils.js # Math helpers
- HTML5 Canvas
- Vanilla JavaScript (ES modules)
- Web Audio API (procedural synthesis, zero audio files)
- Zero external dependencies
- Total size < 100KB
- Open the game in your browser
- Press
F12to open DevTools - Console tab โ check for errors
- Sources tab โ set breakpoints in any JS file
| Issue | Fix |
|---|---|
| Blank screen | Check console for module import errors. Use a local server. |
| Modules not loading | ES modules require HTTP/HTTPS, not file://. |
| Touch not working | Ensure touch-action: none in CSS. Test on actual device or DevTools mobile emulation. |
MIT