debris hereta brillantor i velocitat

This commit is contained in:
2025-12-09 09:25:46 +01:00
parent cd7f06f3a1
commit ec6565bf71
8 changed files with 85 additions and 40 deletions

View File

@@ -417,13 +417,18 @@ void EscenaJoc::tocado() {
// Create ship explosion
const Punt& ship_pos = nau_.get_centre();
float ship_angle = nau_.get_angle();
Punt vel_nau = nau_.get_velocitat_vector();
// Reduir a 80% la velocitat heretada per la nau (més realista)
Punt vel_nau_80 = {vel_nau.x * 0.8f, vel_nau.y * 0.8f};
debris_manager_.explotar(
nau_.get_forma(), // Ship shape (3 lines)
ship_pos, // Center position
ship_angle, // Ship orientation
1.0f, // Normal scale
Defaults::Physics::Debris::VELOCITAT_BASE // 80 px/s
Defaults::Physics::Debris::VELOCITAT_BASE, // 80 px/s
nau_.get_brightness(), // Heredar brightness
vel_nau_80 // Heredar 60% velocitat
);
// Start death timer (non-zero to avoid re-triggering)
@@ -517,12 +522,15 @@ void EscenaJoc::detectar_col·lisions_bales_enemics() {
enemic.destruir();
// 2. Crear explosió de fragments
Punt vel_enemic = enemic.get_velocitat_vector();
debris_manager_.explotar(
enemic.get_forma(), // Forma vectorial del pentàgon
pos_enemic, // Posició central
0.0f, // Angle (enemic té rotació interna)
1.0f, // Escala normal
VELOCITAT_EXPLOSIO // 50 px/s (explosió suau)
enemic.get_forma(), // Forma vectorial del pentàgon
pos_enemic, // Posició central
0.0f, // Angle (enemic té rotació interna)
1.0f, // Escala normal
VELOCITAT_EXPLOSIO, // 50 px/s (explosió suau)
enemic.get_brightness(), // Heredar brightness
vel_enemic // Heredar velocitat
);
// 3. Desactivar bala