| name | canvas-2d-gameplay |
| description | Use when building or reviewing a 2D Air Jam game with canvas so simulation, rendering, SVG/sprite assets, scaling, and collision stay clean instead of collapsing into DOM-heavy ad hoc logic. |
Canvas 2D Gameplay
Use this skill for 2D gameplay rendered on canvas.
Read First
docs/canvas-2d-gameplay.md
docs/generated/state-and-rendering.md
docs/generated/project-structure.md
Core Rule
Use canvas as the gameplay render surface, and keep React/DOM for shell UI and overlays.
Do not try to run the whole game through DOM layout.
Structure Rules
- keep simulation separate from drawing
- keep world coordinates separate from screen and CSS coordinates
- keep HUD and menus in reusable UI modules above the canvas
- keep input interpretation out of the render code
Asset Rules
- LLM-generated SVGs are fine for icons, pickups, simple props, and UI art if they are cleaned up and curated
- keep a consistent visual language across sprites, SVGs, and UI
- prefer a small curated asset set over random mixed-generation output
Movement And Collision Rule
For most 2D games, prefer simple custom movement and collision before reaching for a heavyweight physics layer.
Add a physics engine only when the mechanic truly needs it.
Anti-Patterns
- gameplay logic buried inside draw calls
- DOM elements used as the main simulation surface
- inconsistent scaling between world units and canvas pixels
- random SVGs with mismatched stroke, color, and perspective language
- overcomplicated physics for simple arcade movement