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:
@@ -85,6 +85,8 @@ bool tilemap_load(Tilemap *map, const char *path, SDL_Renderer *renderer) {
|
||||
map->player_spawn = vec2(sx * TILE_SIZE, sy * TILE_SIZE);
|
||||
} else if (strncmp(line, "GRAVITY ", 8) == 0) {
|
||||
sscanf(line + 8, "%f", &map->gravity);
|
||||
} else if (strncmp(line, "WIND ", 5) == 0) {
|
||||
sscanf(line + 5, "%f", &map->wind);
|
||||
} else if (strncmp(line, "TILEDEF ", 8) == 0) {
|
||||
int id, tx, ty;
|
||||
uint32_t flags;
|
||||
|
||||
Reference in New Issue
Block a user