How gustavosoriano/game-canvas works
Game-canvas is a small native JavaScript canvas game. The player jumps over moving obstacles; collisions trigger a loss and restart delay, while passed obstacles increase the score and the score can affect game speed. The sampled code shows gameplay, drawing, and sprite responsibilities, but not the main loop or input-handler implementation, so those connections are omitted.
Main entry points: pedras.js Obstacles · samurai.js Samurai · chao.js Ground · sprite.js Sprite assets
Components 7
Rendering
- Sprite assets
sprite.js
Game state
- Score and speed
score.js
Other components
- Canvas context
- Browser timer and events
Connections 11
- Samurai → Ground: checks landing
- Samurai → Sprite assets: draws frame
- Samurai → Canvas context: draws via
- Obstacles → Samurai: checks collision
- Obstacles → Ground: positions on
- Obstacles → Score and speed: increments
- Obstacles → Sprite assets: draws obstacles
- Obstacles → Browser timer and events: schedules restart
- Score and speed → Canvas context: draws via
- Sprite assets → Canvas context: draws via
- Ground → Canvas context: draws via