feat(entities): migrar paràmetres compartits dels enemics a cada YAML
This commit is contained in:
@@ -1,64 +1,18 @@
|
||||
// enemies.hpp - Configuració per tipus d'enemic (Pentagon/Square/Molinillo), spawn i scoring
|
||||
// enemies.hpp - Constants tècniques compartides per al sistema d'enemics.
|
||||
// © 2026 JailDesigner
|
||||
//
|
||||
// Tots els paràmetres jugables (physics, animation, wounded, spawn,
|
||||
// behavior, colors, scoring) viuen a data/entities/<type>/<type>.yaml i
|
||||
// s'accedeixen via EnemyRegistry::get(EnemyType). Aquí només queda el
|
||||
// que no és per personalitzar per tipus.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Defaults::Enemies {
|
||||
namespace Defaults::Enemies::Spawn {
|
||||
|
||||
// Cuerpo físico común (valores por defecto del constructor)
|
||||
namespace Body {
|
||||
constexpr float DEFAULT_MASS = 5.0F; // Más liviano que la nave (10.0)
|
||||
constexpr float RESTITUTION = 1.0F; // Rebote elástico perfecto contra paredes
|
||||
constexpr float LINEAR_DAMPING = 0.0F; // Sin fricción: mantienen velocidad
|
||||
constexpr float ANGULAR_DAMPING = 0.0F;
|
||||
} // namespace Body
|
||||
// Sostre de reintents al cercar una posició de spawn que respecti el
|
||||
// safety_distance del tipus. No és un paràmetre jugable: és el llindar
|
||||
// tècnic abans de caure a un fallback aleatori amb advertència.
|
||||
constexpr int MAX_SPAWN_ATTEMPTS = 50;
|
||||
|
||||
// NOTA: els paràmetres per tipus (Pentagon/Square/Pinwheel) i el Scoring
|
||||
// viuen ara a data/entities/{pentagon,square,pinwheel}/*.yaml i s'accedeixen
|
||||
// via EnemyRegistry::get(EnemyType). Aquí només queden els paràmetres
|
||||
// compartits entre tots els tipus (animació, wounded, spawn).
|
||||
|
||||
// Animation parameters (shared)
|
||||
namespace Animation {
|
||||
// Palpitation
|
||||
constexpr float PULSE_TRIGGER_PROB = 0.01F; // 1% chance per second
|
||||
constexpr float PULSE_DURATION_MIN = 1.0F; // Min duration (seconds)
|
||||
constexpr float PULSE_DURATION_MAX = 3.0F; // Max duration (seconds)
|
||||
constexpr float PULSE_AMPLITUD_MIN = 0.08F; // Min scale variation
|
||||
constexpr float PULSE_AMPLITUD_MAX = 0.20F; // Max scale variation
|
||||
constexpr float PULSE_FREQ_MIN = 1.5F; // Min frequency (Hz)
|
||||
constexpr float PULSE_FREQ_MAX = 3.0F; // Max frequency (Hz)
|
||||
|
||||
// Rotation acceleration
|
||||
constexpr float ROTATION_ACCEL_TRIGGER_PROB = 0.02F; // 2% chance per second [4x more frequent]
|
||||
constexpr float ROTATION_ACCEL_DURATION_MIN = 3.0F; // Min transition time
|
||||
constexpr float ROTATION_ACCEL_DURATION_MAX = 8.0F; // Max transition time
|
||||
constexpr float ROTATION_ACCEL_MULTIPLIER_MIN = 0.3F; // Min speed multiplier [more dramatic]
|
||||
constexpr float ROTATION_ACCEL_MULTIPLIER_MAX = 4.0F; // Max speed multiplier [more dramatic]
|
||||
} // namespace Animation
|
||||
|
||||
// Wounded state (entre primer impacto y explosión)
|
||||
namespace Wounded {
|
||||
constexpr float DURATION = 1.0F; // Segundos en estado herido antes de explotar
|
||||
constexpr float BLINK_HZ = 10.0F; // Frecuencia de parpadeo color tipo ↔ dorado
|
||||
} // namespace Wounded
|
||||
|
||||
// Spawn safety and invulnerability system
|
||||
namespace Spawn {
|
||||
// Safe spawn distance from player. Antic: SHIP_RADIUS(12) * 3 = 36 px.
|
||||
// SHIP_RADIUS ha migrat al YAML del player; aquesta constant es
|
||||
// mantindrà fixa fins al PR de migració dels enemics a YAML, on
|
||||
// passarà a derivar-se en runtime del player_config.
|
||||
constexpr float SAFETY_DISTANCE_MULTIPLIER = 3.0F;
|
||||
constexpr float SAFETY_DISTANCE = 36.0F;
|
||||
constexpr int MAX_SPAWN_ATTEMPTS = 50; // Max attempts to find safe position
|
||||
|
||||
// Invulnerability system
|
||||
constexpr float INVULNERABILITY_DURATION = 3.0F; // Seconds
|
||||
constexpr float INVULNERABILITY_BRIGHTNESS_START = 0.3F; // Dim
|
||||
constexpr float INVULNERABILITY_BRIGHTNESS_END = 0.7F; // Normal (same as Defaults::Brightness::ENEMIC)
|
||||
constexpr float INVULNERABILITY_SCALE_START = 0.0F; // Invisible
|
||||
constexpr float INVULNERABILITY_SCALE_END = 1.0F; // Full size
|
||||
} // namespace Spawn
|
||||
|
||||
} // namespace Defaults::Enemies
|
||||
} // namespace Defaults::Enemies::Spawn
|
||||
|
||||
Reference in New Issue
Block a user