feat(fireworks): burst radial blanc al explotar enemic + tuning
This commit is contained in:
@@ -3,21 +3,27 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
namespace Defaults::FX::Firework {
|
||||
|
||||
// Color per defecte. La caller pot fer override (p.ex. heretar del pare),
|
||||
// però per defecte no l'heretem — feel més neutre/lluminós.
|
||||
constexpr SDL_Color DEFAULT_COLOR = {.r = 255, .g = 255, .b = 255, .a = 255};
|
||||
|
||||
// Velocitat inicial radial al spawn (px/s) i variació entre punts.
|
||||
constexpr float SPEED = 140.0F;
|
||||
constexpr float SPEED = 250.0F;
|
||||
constexpr float SPEED_VARIATION = 30.0F; // ±
|
||||
|
||||
// Quantitat de línies per burst (per defecte).
|
||||
constexpr int N_POINTS = 8;
|
||||
constexpr int N_POINTS = 100;
|
||||
|
||||
// Distribució angular: jitter aleatori sobre el repartiment uniforme.
|
||||
constexpr float ANGULAR_JITTER_DEG = 12.0F;
|
||||
|
||||
// Fase 1 (creixement): la línia neix amb longitud 0 i creix fins a max.
|
||||
constexpr float GROW_DURATION = 0.08F; // s
|
||||
constexpr float MAX_LENGTH = 14.0F; // px
|
||||
constexpr float MAX_LENGTH = 25.0F; // px
|
||||
|
||||
// Fricció lineal (px/s²). Negativa per frenar.
|
||||
constexpr float FRICTION = -180.0F;
|
||||
@@ -34,6 +40,6 @@ namespace Defaults::FX::Firework {
|
||||
constexpr float RESTITUTION_BOUNDS = 0.7F;
|
||||
|
||||
// Mida del pool. 8 punts × ~25 bursts simultanis.
|
||||
constexpr int POOL_SIZE = 200;
|
||||
constexpr int POOL_SIZE = 2000;
|
||||
|
||||
} // namespace Defaults::FX::Firework
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Effects {
|
||||
// n_points: nombre de línies. Default Defaults::FX::Firework::N_POINTS.
|
||||
// initial_brightness: 0..1.
|
||||
void spawn(const Vec2& origen,
|
||||
SDL_Color color,
|
||||
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);
|
||||
|
||||
@@ -458,6 +458,7 @@ void GameScene::runCollisionDetections() {
|
||||
.score_per_player = score_per_player_,
|
||||
.lives_per_player = lives_per_player_,
|
||||
.debris_manager = debris_manager_,
|
||||
.firework_manager = firework_manager_,
|
||||
.floating_score_manager = floating_score_manager_,
|
||||
.match_config = match_config_,
|
||||
.on_player_hit = [this](uint8_t pid) { tocado(pid); },
|
||||
|
||||
@@ -76,6 +76,10 @@ namespace Systems::Collision {
|
||||
Defaults::Physics::Debris::ENEMY_LIFETIME,
|
||||
Defaults::Physics::Debris::ENEMY_FRICTION,
|
||||
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);
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "core/defaults.hpp"
|
||||
#include "core/system/game_config.hpp"
|
||||
#include "game/effects/debris_manager.hpp"
|
||||
#include "game/effects/firework_manager.hpp"
|
||||
#include "game/effects/floating_score_manager.hpp"
|
||||
#include "game/entities/bullet.hpp"
|
||||
#include "game/entities/enemy.hpp"
|
||||
@@ -36,6 +37,7 @@ namespace Systems::Collision {
|
||||
std::array<int, 2>& score_per_player;
|
||||
std::array<int, 2>& lives_per_player;
|
||||
Effects::DebrisManager& debris_manager;
|
||||
Effects::FireworkManager& firework_manager;
|
||||
Effects::FloatingScoreManager& floating_score_manager;
|
||||
const GameConfig::MatchConfig& match_config;
|
||||
// Trigger de muerte del jugador (GameScene::tocado).
|
||||
|
||||
Reference in New Issue
Block a user