forked from tas/major_tom
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:
@@ -204,6 +204,12 @@ static void projectile_update(Entity *self, float dt, const Tilemap *map) {
|
||||
if (body->vel.y > MAX_FALL_SPEED) body->vel.y = MAX_FALL_SPEED;
|
||||
}
|
||||
|
||||
/* ── Apply wind ─────────────────────────── */
|
||||
float wind = physics_get_wind();
|
||||
if (wind != 0.0f) {
|
||||
body->vel.x += wind * dt;
|
||||
}
|
||||
|
||||
/* ── Move ────────────────────────────────── */
|
||||
body->pos.x += body->vel.x * dt;
|
||||
body->pos.y += body->vel.y * dt;
|
||||
|
||||
Reference in New Issue
Block a user