Fase 8a+b: paleta semantica de color por entidad
Cada entity declara su color de linea via parametro opcional. Cuando
alpha==0 el pipeline cae al color global del oscilador (compatibilidad
con el comportamiento anterior).
Defaults::Palette (defaults.hpp):
- SHIP = blanco neutro
- BULLET = verde laser
- PENTAGON = azul "esquivador"
- QUADRAT = rojo "tank"
- MOLINILLO = magenta agresivo
Pipeline:
- linea(): parametro SDL_Color color (default {0,0,0,0}). En .cpp,
fuente del color = color.a>0 ? color : g_current_line_color.
- render_shape(): parametro SDL_Color color que propaga a cada linea
del shape.
- Debris: campo color en la struct; explode() recibe SDL_Color color
y lo guarda en cada fragment; draw() lo pasa a linea().
Aplicacion:
- Ship::draw -> Palette::SHIP.
- Bullet::draw -> Palette::BULLET.
- Enemy::draw -> Palette::{PENTAGON,QUADRAT,MOLINILLO} segun type_.
- CollisionSystem detectBulletEnemy: debris hereda color del enemy.
- GameScene::tocado: debris hereda Palette::SHIP.
Smoke test xvfb OK.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,13 @@ void detectBulletEnemy(Context& ctx) {
|
||||
ctx.score_per_player[owner_id] += points;
|
||||
ctx.floating_score_manager.crear(points, POS_ENEMIC);
|
||||
|
||||
// 2. Destruir enemy + crear explosión
|
||||
// 2. Destruir enemy + crear explosión (debris hereda color del enemy)
|
||||
SDL_Color enemy_color{};
|
||||
switch (enemy.getType()) {
|
||||
case EnemyType::PENTAGON: enemy_color = Defaults::Palette::PENTAGON; break;
|
||||
case EnemyType::QUADRAT: enemy_color = Defaults::Palette::QUADRAT; break;
|
||||
case EnemyType::MOLINILLO: enemy_color = Defaults::Palette::MOLINILLO; break;
|
||||
}
|
||||
enemy.destruir();
|
||||
Vec2 vel_enemic = enemy.getVelocityVector();
|
||||
ctx.debris_manager.explode(
|
||||
@@ -53,7 +59,9 @@ void detectBulletEnemy(Context& ctx) {
|
||||
enemy.getBrightness(),
|
||||
vel_enemic,
|
||||
enemy.getRotationDelta(),
|
||||
0.0F // sin herencia visual
|
||||
0.0F, // sin herencia visual
|
||||
Defaults::Sound::EXPLOSION,
|
||||
enemy_color
|
||||
);
|
||||
|
||||
// 3. Desactivar bullet (solo destruye 1 enemy)
|
||||
|
||||
Reference in New Issue
Block a user