tune(enemy): trossos parcials i firework petit en color wounded

This commit is contained in:
2026-05-25 22:47:31 +02:00
parent 14b10c663e
commit 9e745dc3fc
2 changed files with 21 additions and 17 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ health: 10
events: events:
on_hit: on_hit:
- action: decrease_health # primer: si arriba a 0 dispara on_no_health - action: decrease_health # primer: si arriba a 0 dispara on_no_health
- action: flash # feedback visual de damage parcial #- action: flash # feedback visual de damage parcial
- action: create_debris_partial # xip a 0.3x mida (sense ser letal) - action: create_debris_partial # xip a 0.3x mida (sense ser letal)
- action: create_fireworks_small # espurna a cada hit (12 punts, lent) - action: create_fireworks_small # espurna a cada hit (12 punts, lent)
- action: apply_impulse # empenta el cos (skip si will_die) - action: apply_impulse # empenta el cos (skip si will_die)
+20 -16
View File
@@ -25,9 +25,9 @@ namespace Systems::EnemyEvents {
} }
// Helper compartit per CREATE_DEBRIS i CREATE_DEBRIS_PARTIAL: única // Helper compartit per CREATE_DEBRIS i CREATE_DEBRIS_PARTIAL: única
// crida a explode(), paràmetres alineats; només canvia piece_scale // crida a explode(), paràmetres alineats; només canvien piece_scale
// (1.0 = explosió completa, 0.3 = xip d'esquerda). // (1.0 explosió, 0.3 xip) i el color (cos vs hit-feedback).
void spawnDebrisForEnemy(Systems::Collision::Context& ctx, const Enemy& enemy, const Bullet* bullet, float piece_scale) { void spawnDebrisForEnemy(Systems::Collision::Context& ctx, const Enemy& enemy, const Bullet* bullet, float piece_scale, SDL_Color color) {
constexpr float SPEED_EXPLOSIO = 80.0F; constexpr float SPEED_EXPLOSIO = 80.0F;
const Vec2 INHERITED_VEL = enemy.getVelocityVector() * const Vec2 INHERITED_VEL = enemy.getVelocityVector() *
Defaults::Physics::Debris::ENEMY_VELOCITY_INHERITANCE; Defaults::Physics::Debris::ENEMY_VELOCITY_INHERITANCE;
@@ -43,7 +43,7 @@ namespace Systems::EnemyEvents {
0.0F, 0.0F,
0.0F, 0.0F,
Defaults::Sound::EXPLOSION, Defaults::Sound::EXPLOSION,
enemy.getConfig().colors.normal, color,
Defaults::Physics::Debris::ENEMY_LIFETIME, Defaults::Physics::Debris::ENEMY_LIFETIME,
Defaults::Physics::Debris::ENEMY_FRICTION, Defaults::Physics::Debris::ENEMY_FRICTION,
Defaults::Physics::Debris::ENEMY_SEGMENT_MULTIPLIER, Defaults::Physics::Debris::ENEMY_SEGMENT_MULTIPLIER,
@@ -52,11 +52,11 @@ namespace Systems::EnemyEvents {
} }
// Helper compartit per CREATE_FIREWORKS i CREATE_FIREWORKS_SMALL: // Helper compartit per CREATE_FIREWORKS i CREATE_FIREWORKS_SMALL:
// mateixa crida a spawn(), només canvien n_points, initial_speed i // mateixa crida a spawn(); els callers decideixen line_color, glow_color,
// glow_color segons el "tamany" del burst (mort vs feedback per hit). // n_points i initial_speed segons el "tamany" del burst (mort vs hit).
void spawnFireworksForEnemy(Systems::Collision::Context& ctx, const Enemy& enemy, int n_points, float initial_speed, SDL_Color glow_color) { void spawnFireworksForEnemy(Systems::Collision::Context& ctx, const Enemy& enemy, int n_points, float initial_speed, SDL_Color line_color, SDL_Color glow_color) {
ctx.firework_manager.spawn(enemy.getCenter(), ctx.firework_manager.spawn(enemy.getCenter(),
Defaults::FX::Firework::DEFAULT_COLOR, line_color,
initial_speed, initial_speed,
n_points, n_points,
Defaults::FX::Firework::INITIAL_BRIGHTNESS, Defaults::FX::Firework::INITIAL_BRIGHTNESS,
@@ -120,20 +120,24 @@ namespace Systems::EnemyEvents {
doAddScore(ctx, enemy, shooter_id); doAddScore(ctx, enemy, shooter_id);
break; break;
case EnemyActionType::CREATE_DEBRIS: case EnemyActionType::CREATE_DEBRIS:
spawnDebrisForEnemy(ctx, enemy, bullet, 1.0F); // Explosió de mort: trossos en color cos (correcte físicament).
spawnDebrisForEnemy(ctx, enemy, bullet, 1.0F, enemy.getConfig().colors.normal);
break; break;
case EnemyActionType::CREATE_DEBRIS_PARTIAL: case EnemyActionType::CREATE_DEBRIS_PARTIAL:
spawnDebrisForEnemy(ctx, enemy, bullet, Defaults::Enemies::Debris::PARTIAL_PIECE_SCALE); // Xip d'impacte: trossos en color wounded (daurat) per
// diferenciar-los visualment del cos i marcar "damage".
spawnDebrisForEnemy(ctx, enemy, bullet, Defaults::Enemies::Debris::PARTIAL_PIECE_SCALE, enemy.getConfig().colors.wounded);
break; break;
case EnemyActionType::CREATE_FIREWORKS: case EnemyActionType::CREATE_FIREWORKS:
// Burst de mort: glow amb el color wounded (daurat) per // Burst de mort: línia blanca + glow wounded (daurat) per
// marcar la mort com a esdeveniment "calent". // marcar la mort com a esdeveniment "calent" i lluminós.
spawnFireworksForEnemy(ctx, enemy, Defaults::FX::Firework::N_POINTS, Defaults::FX::Firework::SPEED, enemy.getConfig().colors.wounded); spawnFireworksForEnemy(ctx, enemy, Defaults::FX::Firework::N_POINTS, Defaults::FX::Firework::SPEED, Defaults::FX::Firework::DEFAULT_COLOR, enemy.getConfig().colors.wounded);
break; break;
case EnemyActionType::CREATE_FIREWORKS_SMALL: case EnemyActionType::CREATE_FIREWORKS_SMALL:
// Burst d'impacte: glow amb el color de l'enemic, perquè // Espurna d'impacte: línia + glow tots dos en wounded
// l'espurna llegisca com a "tros del propi cos saltant". // (daurat) per contrastar amb el cos i unificar la "tema
spawnFireworksForEnemy(ctx, enemy, Defaults::Enemies::Fireworks::SMALL_N_POINTS, Defaults::Enemies::Fireworks::SMALL_SPEED, enemy.getConfig().colors.normal); // de damage" amb el debris parcial.
spawnFireworksForEnemy(ctx, enemy, Defaults::Enemies::Fireworks::SMALL_N_POINTS, Defaults::Enemies::Fireworks::SMALL_SPEED, enemy.getConfig().colors.wounded, enemy.getConfig().colors.wounded);
break; break;
case EnemyActionType::APPLY_IMPULSE: case EnemyActionType::APPLY_IMPULSE:
if (!will_die) { if (!will_die) {