feat(firework): halo neon per partícula amb color de glow propi (explosió enemic: línia blanca + halo daurat)
This commit is contained in:
1 parent
7b9b5ce569
commit
c32b564da1
7 files changed
+96
-12
No files matched your search
@@ -35,6 +35,11 @@ namespace Effects {
|
||||
|
||||
float brightness; // 0..1
|
||||
SDL_Color color{}; // alpha==0 → oscilador global
|
||||
// Halo neon (off per defecte). Si glow_color.a > 0, el halo usa
|
||||
// glow_color (línia blanca + halo daurat, p.ex.); si alpha==0, el
|
||||
// halo agafa el color de la línia.
|
||||
bool glow{false};
|
||||
SDL_Color glow_color{};
|
||||
bool active;
|
||||
};
|
||||
|
||||
|
||||
@@ -65,7 +65,9 @@ namespace Effects {
|
||||
SDL_Color color,
|
||||
float initial_speed,
|
||||
int n_points,
|
||||
float initial_brightness) {
|
||||
float initial_brightness,
|
||||
bool glow,
|
||||
SDL_Color glow_color) {
|
||||
if (n_points <= 0) {
|
||||
return;
|
||||
}
|
||||
@@ -105,6 +107,8 @@ namespace Effects {
|
||||
|
||||
fw->brightness = initial_brightness;
|
||||
fw->color = color;
|
||||
fw->glow = glow;
|
||||
fw->glow_color = glow_color;
|
||||
fw->active = true;
|
||||
}
|
||||
}
|
||||
@@ -185,14 +189,26 @@ namespace Effects {
|
||||
.y = fw.head.y - (DIR_Y * fw.current_length),
|
||||
};
|
||||
|
||||
Rendering::linea(renderer_,
|
||||
static_cast<int>(fw.head.x),
|
||||
static_cast<int>(fw.head.y),
|
||||
static_cast<int>(TAIL.x),
|
||||
static_cast<int>(TAIL.y),
|
||||
fw.brightness,
|
||||
0.0F,
|
||||
fw.color);
|
||||
if (fw.glow) {
|
||||
Rendering::lineaGlow(renderer_,
|
||||
static_cast<int>(fw.head.x),
|
||||
static_cast<int>(fw.head.y),
|
||||
static_cast<int>(TAIL.x),
|
||||
static_cast<int>(TAIL.y),
|
||||
fw.brightness,
|
||||
0.0F,
|
||||
fw.color,
|
||||
fw.glow_color);
|
||||
} else {
|
||||
Rendering::linea(renderer_,
|
||||
static_cast<int>(fw.head.x),
|
||||
static_cast<int>(fw.head.y),
|
||||
static_cast<int>(TAIL.x),
|
||||
static_cast<int>(TAIL.y),
|
||||
fw.brightness,
|
||||
0.0F,
|
||||
fw.color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,15 @@ namespace Effects {
|
||||
// initial_speed: velocitat radial inicial (px/s).
|
||||
// n_points: nombre de línies. Default Defaults::FX::Firework::N_POINTS.
|
||||
// initial_brightness: 0..1.
|
||||
// glow: si true, cada partícula es renderitza amb halo neon.
|
||||
// glow_color: color del halo. Si alpha==0, agafa el color de la línia.
|
||||
void spawn(const Vec2& origen,
|
||||
SDL_Color color = Defaults::FX::Firework::DEFAULT_COLOR,
|
||||
float initial_speed = Defaults::FX::Firework::SPEED,
|
||||
int n_points = Defaults::FX::Firework::N_POINTS,
|
||||
float initial_brightness = Defaults::FX::Firework::INITIAL_BRIGHTNESS);
|
||||
float initial_brightness = Defaults::FX::Firework::INITIAL_BRIGHTNESS,
|
||||
bool glow = false,
|
||||
SDL_Color glow_color = {0, 0, 0, 0});
|
||||
|
||||
void update(float delta_time);
|
||||
void draw() const;
|
||||
|
||||
@@ -79,8 +79,14 @@ namespace Systems::Collision {
|
||||
Defaults::Physics::Debris::ENEMY_SEGMENT_MULTIPLIER);
|
||||
|
||||
// Firework burst radial des del centro de l'enemic (efecte adicional al debris).
|
||||
// No heretem color: el burst usa el blanc per defecte per a un feel més lluminós.
|
||||
ctx.firework_manager.spawn(ENEMY_POS);
|
||||
// Línia blanca + halo daurat (WOUNDED) per a feel d'espurnes.
|
||||
ctx.firework_manager.spawn(ENEMY_POS,
|
||||
Defaults::FX::Firework::DEFAULT_COLOR,
|
||||
Defaults::FX::Firework::SPEED,
|
||||
Defaults::FX::Firework::N_POINTS,
|
||||
Defaults::FX::Firework::INITIAL_BRIGHTNESS,
|
||||
/*glow=*/true,
|
||||
Defaults::Palette::WOUNDED);
|
||||
}
|
||||
|
||||
// Trenca una bala en debris (8 fragments de l'octàgon) + so HIT + desactiva.
|
||||
|
||||
Reference in new issue
Block a user