forked from tas/major_tom
Refine asteroids: faster, sparser, with horizontal drift
Increase base fall speed (120→200), acceleration (200→350), and respawn delay (3→6s). Add random horizontal drift (±60 px/s) so asteroids fall at angles. Widen initial stagger (0-3→0-8s). Reduce moon level from 24 asteroids to 8, spread evenly across the level.
This commit is contained in:
8
TODO.md
8
TODO.md
@@ -26,8 +26,6 @@ Ship landing at exit zone when player approaches — player enters, ship takes
|
|||||||
off, triggers level transition. The intro/start sequence is done; this is the
|
off, triggers level transition. The intro/start sequence is done; this is the
|
||||||
exit counterpart.
|
exit counterpart.
|
||||||
|
|
||||||
## Asteroid refinement
|
## ~~Asteroid refinement~~ ✓
|
||||||
- Reduce asteroid count significantly — occasional hazard, not a barrage
|
Implemented: base speed 120→200, accel 200→350, respawn 3→6s, stagger 0-3→0-8s,
|
||||||
- Add slight horizontal drift so they fall at an angle rather than straight down
|
random horizontal drift (±60 px/s), moon level reduced from 24 to 8 asteroids.
|
||||||
- Increase fall speed for more impact
|
|
||||||
- Stagger spawns more widely across the level
|
|
||||||
|
|||||||
@@ -14,29 +14,14 @@ PLAYER_UNARMED
|
|||||||
|
|
||||||
ENTITY spacecraft 1 14
|
ENTITY spacecraft 1 14
|
||||||
|
|
||||||
ENTITY asteroid 66 1
|
ENTITY asteroid 68 1
|
||||||
ENTITY asteroid 70 1
|
ENTITY asteroid 85 2
|
||||||
ENTITY asteroid 74 1
|
ENTITY asteroid 96 1
|
||||||
ENTITY asteroid 77 1
|
ENTITY asteroid 113 0
|
||||||
ENTITY asteroid 89 2
|
ENTITY asteroid 130 2
|
||||||
ENTITY asteroid 92 2
|
ENTITY asteroid 148 1
|
||||||
ENTITY asteroid 95 2
|
ENTITY asteroid 163 2
|
||||||
ENTITY asteroid 97 2
|
ENTITY asteroid 178 0
|
||||||
ENTITY asteroid 100 2
|
|
||||||
ENTITY asteroid 109 0
|
|
||||||
ENTITY asteroid 112 0
|
|
||||||
ENTITY asteroid 115 0
|
|
||||||
ENTITY asteroid 118 0
|
|
||||||
ENTITY asteroid 141 1
|
|
||||||
ENTITY asteroid 144 1
|
|
||||||
ENTITY asteroid 147 1
|
|
||||||
ENTITY asteroid 150 1
|
|
||||||
ENTITY asteroid 154 1
|
|
||||||
ENTITY asteroid 162 2
|
|
||||||
ENTITY asteroid 165 2
|
|
||||||
ENTITY asteroid 168 2
|
|
||||||
ENTITY asteroid 171 2
|
|
||||||
ENTITY asteroid 174 2
|
|
||||||
|
|
||||||
EXIT 196 17 2 3 assets/levels/level01.lvl
|
EXIT 196 17 2 3 assets/levels/level01.lvl
|
||||||
|
|
||||||
|
|||||||
@@ -632,14 +632,19 @@ static void asteroid_update(Entity *self, float dt, const Tilemap *map) {
|
|||||||
ad->falling = true;
|
ad->falling = true;
|
||||||
ad->trail_timer = 0;
|
ad->trail_timer = 0;
|
||||||
ad->fall_speed = ASTEROID_FALL_SPEED;
|
ad->fall_speed = ASTEROID_FALL_SPEED;
|
||||||
|
/* Randomize drift direction each fall */
|
||||||
|
ad->drift_x = ((float)(rand() % 201) - 100.0f) / 100.0f * ASTEROID_DRIFT_MAX;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Accelerate while falling (gravity-like) */
|
/* Accelerate while falling (gravity-like) */
|
||||||
ad->fall_speed += 200.0f * dt;
|
ad->fall_speed += ASTEROID_ACCEL * dt;
|
||||||
self->body.pos.y += ad->fall_speed * dt;
|
self->body.pos.y += ad->fall_speed * dt;
|
||||||
|
|
||||||
|
/* Apply horizontal drift */
|
||||||
|
self->body.pos.x += ad->drift_x * dt;
|
||||||
|
|
||||||
/* Tumble animation */
|
/* Tumble animation */
|
||||||
animation_update(&self->anim, dt);
|
animation_update(&self->anim, dt);
|
||||||
|
|
||||||
@@ -794,12 +799,13 @@ Entity *asteroid_spawn(EntityManager *em, Vec2 pos) {
|
|||||||
ad->spawn_pos = pos;
|
ad->spawn_pos = pos;
|
||||||
ad->falling = true;
|
ad->falling = true;
|
||||||
ad->fall_speed = ASTEROID_FALL_SPEED;
|
ad->fall_speed = ASTEROID_FALL_SPEED;
|
||||||
|
ad->drift_x = ((float)(rand() % 201) - 100.0f) / 100.0f * ASTEROID_DRIFT_MAX;
|
||||||
ad->trail_timer = 0;
|
ad->trail_timer = 0;
|
||||||
ad->respawn_timer = 0;
|
ad->respawn_timer = 0;
|
||||||
/* Stagger start times based on spawn position to avoid all falling at once */
|
/* Stagger start times based on spawn position to avoid all falling at once */
|
||||||
ad->start_delay = (pos.x * 0.013f + pos.y * 0.007f);
|
ad->start_delay = (pos.x * 0.013f + pos.y * 0.007f);
|
||||||
ad->start_delay = ad->start_delay - (float)(int)ad->start_delay; /* frac part */
|
ad->start_delay = ad->start_delay - (float)(int)ad->start_delay; /* frac part */
|
||||||
ad->start_delay *= 3.0f; /* 0-3s stagger */
|
ad->start_delay *= 8.0f; /* 0-8s stagger */
|
||||||
e->data = ad;
|
e->data = ad;
|
||||||
|
|
||||||
animation_set(&e->anim, &anim_asteroid);
|
animation_set(&e->anim, &anim_asteroid);
|
||||||
|
|||||||
@@ -95,13 +95,16 @@ Entity *force_field_spawn(EntityManager *em, Vec2 pos);
|
|||||||
|
|
||||||
#define ASTEROID_WIDTH 14
|
#define ASTEROID_WIDTH 14
|
||||||
#define ASTEROID_HEIGHT 14
|
#define ASTEROID_HEIGHT 14
|
||||||
#define ASTEROID_FALL_SPEED 120.0f /* base fall speed (px/s) */
|
#define ASTEROID_FALL_SPEED 200.0f /* base fall speed (px/s) */
|
||||||
|
#define ASTEROID_ACCEL 350.0f /* fall acceleration (px/s^2) */
|
||||||
|
#define ASTEROID_DRIFT_MAX 60.0f /* max horizontal drift (px/s) */
|
||||||
#define ASTEROID_DAMAGE 1
|
#define ASTEROID_DAMAGE 1
|
||||||
#define ASTEROID_RESPAWN 3.0f /* seconds before respawning */
|
#define ASTEROID_RESPAWN 6.0f /* seconds before respawning */
|
||||||
|
|
||||||
typedef struct AsteroidData {
|
typedef struct AsteroidData {
|
||||||
Vec2 spawn_pos; /* original position (for reset)*/
|
Vec2 spawn_pos; /* original position (for reset)*/
|
||||||
float fall_speed; /* current fall velocity */
|
float fall_speed; /* current fall velocity */
|
||||||
|
float drift_x; /* horizontal velocity (px/s) */
|
||||||
float respawn_timer; /* countdown while inactive */
|
float respawn_timer; /* countdown while inactive */
|
||||||
bool falling; /* true = falling, false = wait */
|
bool falling; /* true = falling, false = wait */
|
||||||
float trail_timer; /* particle trail interval */
|
float trail_timer; /* particle trail interval */
|
||||||
|
|||||||
Reference in New Issue
Block a user