2D games skill

2D game development principles.

by davila7·MIT license·★ 32,299 Stars on the repo·GitHub ↗

Use now

Files of 2D games

davila7/main1 file shown
SKILL.md
Show the full text120 lines

2D Game Development

Principles for 2D game systems.


1. Sprite Systems

Sprite Organization
Component Purpose
Atlas Combine textures, reduce draw calls
Animation Frame sequences
Pivot Rotation/scale origin
Layering Z-order control
Animation Principles
  • Frame rate: 8-24 FPS typical
  • Squash and stretch for impact
  • Anticipation before action
  • Follow-through after action

2. Tilemap Design

Tile Considerations
Factor Recommendation
Size 16x16, 32x32, 64x64
Auto-tiling Use for terrain
Collision Simplified shapes
Layers
Layer Content
Background Non-interactive scenery
Terrain Walkable ground
Props Interactive objects
Foreground Parallax overlay

3. 2D Physics

Collision Shapes
Shape Use Case
Box Rectangular objects
Circle Balls, rounded
Capsule Characters
Polygon Complex shapes
Physics Considerations
  • Pixel-perfect vs physics-based
  • Fixed timestep for consistency
  • Layers for filtering

4. Camera Systems

Camera Types
Type Use
Follow Track player
Look-ahead Anticipate movement
Multi-target Two-player
Room-based Metroidvania
Screen Shake
  • Short duration (50-200ms)
  • Diminishing intensity
  • Use sparingly

5. Genre Patterns

Platformer
  • Coyote time (leniency after edge)
  • Jump buffering
  • Variable jump height
Top-down
  • 8-directional or free movement
  • Aim-based or auto-aim
  • Consider rotation or not

6. Anti-Patterns

❌ Don't ✅ Do
Separate textures Use atlases
Complex collision shapes Simplified collision
Jittery camera Smooth following
Pixel-perfect on physics Choose one approach

Remember: 2D is about clarity. Every pixel should communicate.

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

Discussion