$npx -y skills add One-Man-Company/Skills-ContextManager --skill 2d-games2D game development principles. Sprites, tilemaps, physics, camera.
| 1 | # 2D Game Development |
| 2 | |
| 3 | > Principles for 2D game systems. |
| 4 | |
| 5 | --- |
| 6 | |
| 7 | ## 1. Sprite Systems |
| 8 | |
| 9 | ### Sprite Organization |
| 10 | |
| 11 | | Component | Purpose | |
| 12 | |-----------|---------| |
| 13 | | **Atlas** | Combine textures, reduce draw calls | |
| 14 | | **Animation** | Frame sequences | |
| 15 | | **Pivot** | Rotation/scale origin | |
| 16 | | **Layering** | Z-order control | |
| 17 | |
| 18 | ### Animation Principles |
| 19 | |
| 20 | - Frame rate: 8-24 FPS typical |
| 21 | - Squash and stretch for impact |
| 22 | - Anticipation before action |
| 23 | - Follow-through after action |
| 24 | |
| 25 | --- |
| 26 | |
| 27 | ## 2. Tilemap Design |
| 28 | |
| 29 | ### Tile Considerations |
| 30 | |
| 31 | | Factor | Recommendation | |
| 32 | |--------|----------------| |
| 33 | | **Size** | 16x16, 32x32, 64x64 | |
| 34 | | **Auto-tiling** | Use for terrain | |
| 35 | | **Collision** | Simplified shapes | |
| 36 | |
| 37 | ### Layers |
| 38 | |
| 39 | | Layer | Content | |
| 40 | |-------|---------| |
| 41 | | Background | Non-interactive scenery | |
| 42 | | Terrain | Walkable ground | |
| 43 | | Props | Interactive objects | |
| 44 | | Foreground | Parallax overlay | |
| 45 | |
| 46 | --- |
| 47 | |
| 48 | ## 3. 2D Physics |
| 49 | |
| 50 | ### Collision Shapes |
| 51 | |
| 52 | | Shape | Use Case | |
| 53 | |-------|----------| |
| 54 | | Box | Rectangular objects | |
| 55 | | Circle | Balls, rounded | |
| 56 | | Capsule | Characters | |
| 57 | | Polygon | Complex shapes | |
| 58 | |
| 59 | ### Physics Considerations |
| 60 | |
| 61 | - Pixel-perfect vs physics-based |
| 62 | - Fixed timestep for consistency |
| 63 | - Layers for filtering |
| 64 | |
| 65 | --- |
| 66 | |
| 67 | ## 4. Camera Systems |
| 68 | |
| 69 | ### Camera Types |
| 70 | |
| 71 | | Type | Use | |
| 72 | |------|-----| |
| 73 | | **Follow** | Track player | |
| 74 | | **Look-ahead** | Anticipate movement | |
| 75 | | **Multi-target** | Two-player | |
| 76 | | **Room-based** | Metroidvania | |
| 77 | |
| 78 | ### Screen Shake |
| 79 | |
| 80 | - Short duration (50-200ms) |
| 81 | - Diminishing intensity |
| 82 | - Use sparingly |
| 83 | |
| 84 | --- |
| 85 | |
| 86 | ## 5. Genre Patterns |
| 87 | |
| 88 | ### Platformer |
| 89 | |
| 90 | - Coyote time (leniency after edge) |
| 91 | - Jump buffering |
| 92 | - Variable jump height |
| 93 | |
| 94 | ### Top-down |
| 95 | |
| 96 | - 8-directional or free movement |
| 97 | - Aim-based or auto-aim |
| 98 | - Consider rotation or not |
| 99 | |
| 100 | --- |
| 101 | |
| 102 | ## 6. Anti-Patterns |
| 103 | |
| 104 | | ❌ Don't | ✅ Do | |
| 105 | |----------|-------| |
| 106 | | Separate textures | Use atlases | |
| 107 | | Complex collision shapes | Simplified collision | |
| 108 | | Jittery camera | Smooth following | |
| 109 | | Pixel-perfect on physics | Choose one approach | |
| 110 | |
| 111 | --- |
| 112 | |
| 113 | > **Remember:** 2D is about clarity. Every pixel should communicate. |