2d-games
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese2D Game Development
2D游戏开发
Principles for 2D game systems.
2D游戏系统开发原则。
1. Sprite Systems
1. Sprite系统
Sprite Organization
Sprite组织
| Component | Purpose |
|---|---|
| Atlas | Combine textures, reduce draw calls |
| Animation | Frame sequences |
| Pivot | Rotation/scale origin |
| Layering | Z-order control |
| 组件 | 用途 |
|---|---|
| Atlas | 合并纹理,减少绘制调用 |
| Animation | 帧序列 |
| Pivot | 旋转/缩放原点 |
| Layering | Z轴顺序控制 |
Animation Principles
Animation原则
- Frame rate: 8-24 FPS typical
- Squash and stretch for impact
- Anticipation before action
- Follow-through after action
- 帧率:通常为8-24 FPS
- 挤压和拉伸以增强冲击力
- 动作前的预备动作
- 动作后的跟随动作
2. Tilemap Design
2. Tilemap设计
Tile Considerations
Tile考量因素
| Factor | Recommendation |
|---|---|
| Size | 16x16, 32x32, 64x64 |
| Auto-tiling | Use for terrain |
| Collision | Simplified shapes |
| 因素 | 建议 |
|---|---|
| 尺寸 | 16x16, 32x32, 64x64 |
| Auto-tiling | 用于地形绘制 |
| Collision | 使用简化形状 |
Layers
分层
| Layer | Content |
|---|---|
| Background | Non-interactive scenery |
| Terrain | Walkable ground |
| Props | Interactive objects |
| Foreground | Parallax overlay |
| 层级 | 内容 |
|---|---|
| 背景层 | 非交互式场景 |
| 地形层 | 可行走地面 |
| 道具层 | 交互式对象 |
| 前景层 | 视差叠加层 |
3. 2D Physics
3. 2D Physics系统
Collision Shapes
Collision形状
| Shape | Use Case |
|---|---|
| Box | Rectangular objects |
| Circle | Balls, rounded |
| Capsule | Characters |
| Polygon | Complex shapes |
| 形状 | 使用场景 |
|---|---|
| 矩形 | 矩形物体 |
| 圆形 | 球体、圆角物体 |
| 胶囊形 | 角色 |
| 多边形 | 复杂形状 |
Physics Considerations
Physics系统考量
- Pixel-perfect vs physics-based
- Fixed timestep for consistency
- Layers for filtering
- 像素完美碰撞 vs 基于Physics的碰撞
- 使用固定时间步长保证一致性
- 通过分层进行碰撞过滤
4. Camera Systems
4. Camera系统
Camera Types
Camera类型
| Type | Use |
|---|---|
| Follow | Track player |
| Look-ahead | Anticipate movement |
| Multi-target | Two-player |
| Room-based | Metroidvania |
| 类型 | 用途 |
|---|---|
| Follow Camera | 追踪玩家 |
| Look-ahead Camera | 预判移动方向 |
| Multi-target Camera | 双人游戏 |
| Room-based Camera | 类银河恶魔城游戏 |
Screen Shake
屏幕震动
- Short duration (50-200ms)
- Diminishing intensity
- Use sparingly
- 短时长(50-200ms)
- 强度逐渐减弱
- 谨慎使用
5. Genre Patterns
5. 游戏类型模式
Platformer
平台跳跃类
- Coyote time (leniency after edge)
- Jump buffering
- Variable jump height
- Coyote time(边缘掉落的容错时间)
- 跳跃缓冲
- 可变跳跃高度
Top-down
俯视角类
- 8-directional or free movement
- Aim-based or auto-aim
- Consider rotation or not
- 8方向或自由移动
- 瞄准式或自动瞄准
- 考虑是否启用旋转
6. Anti-Patterns
6. 反模式
| ❌ 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.
| ❌ 不要做 | ✅ 应该做 |
|---|---|
| 使用独立纹理 | 使用Atlas |
| 复杂Collision形状 | 使用简化碰撞 |
| 抖动的Camera | 平滑跟随 |
| Physics系统采用像素完美碰撞 | 选择一种方案 |
注意: 2D游戏的核心是清晰表达。每一个像素都应传递信息。