How siapmn/tower_game works
Tower Building Game is a browser-based Canvas stacking game. A player starts a round and taps to release swinging blocks; the game resolves placement, updates floors, score, and remaining lives, and ends after three failures. The main runtime entry configures the engine, game objects, rendering, and touch input. Separate components handle background and scenery, block physics, and scoring/rule callbacks. The README documents configurable dimensions, sound, scoring, motion functions, and result hooks. Edges reflect the entry-point wiring and sampled calls; unsampled integrations are not inferred.
Main entry points: index.js Game Setup · block.js Block Physics · animateFuncs.js Game Animation · utils.js Touch Input
Components 15
Game Runtime
- Game Setup
src/index.js - Canvas Engine
- Touch Input
src/utils.js - Game Animation
src/animateFuncs.js
Stacking Gameplay
- Block Physics
src/block.js - Landing Line
src/line.js - Swinging Hook
src/hook.js - Tap Tutorial
src/tutorial.js
Canvas Scene
- Background
src/background.js - Cloud Scenery
src/cloud.js - Flight Effects
src/flight.js - Score Display
src/animateFuncs.js
Rules And State
- Score And Lives
src/utils.js - Game Rules
src/constant.js
Other components
- Player
Connections 18
- Player → Game Setup: starts game
README.md - Game Setup → Canvas Engine: creates engine
src/index.js - Game Setup → Touch Input: registers touch
src/index.js - Player → Touch Input: taps to drop
- Game Setup → Game Animation: sets animations
src/index.js - Game Setup → Background: sets background
src/index.js - Game Setup → Landing Line: registers instance
src/index.js - Game Setup → Swinging Hook: registers instance
src/index.js - Game Setup → Cloud Scenery: registers instances
src/index.js - Game Setup → Tap Tutorial: adds tutorial
src/index.js - Touch Input → Block Physics: updates drop state
src/utils.js - Game Animation → Block Physics: creates blocks
src/animateFuncs.js - Game Animation → Flight Effects: adds effects
src/animateFuncs.js - Block Physics → Landing Line: checks collision
src/block.js - Block Physics → Score And Lives: updates outcomes
src/block.js - Block Physics → Game Rules: reads game state
src/block.js - Score And Lives → Game Rules: reads options
src/utils.js - Game Animation → Score Display: draws status
src/animateFuncs.js