Add per-level wind atmosphere property

WIND directive in .lvl files sets a constant horizontal force (px/s^2)
that pushes entities, projectiles, and particles. Positive is rightward.

Wind is applied as acceleration in physics_update() (halved on ground),
directly to projectile and particle velocities, and as a gentle position
drift on flyers. Entities with gravity_scale=0 (drones, spacecraft) are
unaffected. Levels default to no wind when the directive is absent.
This commit is contained in:
Thomas
2026-03-01 17:13:01 +00:00
parent cdba479ced
commit 6c4b076c68
11 changed files with 56 additions and 5 deletions

View File

@@ -48,7 +48,7 @@ Each level defines its own atmosphere, affecting gameplay feel:
| `MUSIC` | Level music track | assets/music/level1.ogg |
| `PALETTE` | Color mood (warm, cold, toxic, void) | tint/filter values |
Already implemented: `GRAVITY`, `BG_COLOR`, `MUSIC`, `PARALLAX_FAR`, `PARALLAX_NEAR` (all per-level). Parallax backgrounds are procedurally generated (starfield + nebula) when no image path is specified.
Already implemented: `GRAVITY`, `WIND`, `BG_COLOR`, `MUSIC`, `PARALLAX_FAR`, `PARALLAX_NEAR` (all per-level). Parallax backgrounds are procedurally generated (starfield + nebula) when no image path is specified.
---
@@ -118,11 +118,10 @@ adding a new def. See `src/game/projectile.h` for the full definition.
## Levels
### Format (.lvl)
Current directives: `TILESET`, `SIZE`, `SPAWN`, `GRAVITY`, `BG_COLOR`, `MUSIC`, `PARALLAX_FAR`, `PARALLAX_NEAR`, `TILEDEF`, `ENTITY`, `LAYER`
Current directives: `TILESET`, `SIZE`, `SPAWN`, `GRAVITY`, `WIND`, `BG_COLOR`, `MUSIC`, `PARALLAX_FAR`, `PARALLAX_NEAR`, `TILEDEF`, `ENTITY`, `EXIT`, `LAYER`
**Needed additions:**
- `EXIT <tile_x> <tile_y> <next_level>` — Level exit zone
- `WIND`, `STORM`, `DRAG` — Atmosphere settings
- `STORM`, `DRAG` — Remaining atmosphere settings
### Level Ideas
@@ -166,7 +165,8 @@ Current directives: `TILESET`, `SIZE`, `SPAWN`, `GRAVITY`, `BG_COLOR`, `MUSIC`,
### Medium Priority
- [x] In-game level editor (tile/entity placement, save/load, test play)
- [ ] Wind / drag atmosphere properties
- [x] Wind atmosphere property (`WIND` directive, affects all entities/particles/projectiles)
- [ ] Drag atmosphere property
- [x] Parallax scrolling backgrounds (procedural stars + nebula, or from image files)
- [x] Per-level background color (`BG_COLOR` directive)
- [x] Music playback per level (`MUSIC` directive)