respawn de nau i invulnerabilitat

This commit is contained in:
2025-12-10 11:35:45 +01:00
parent 9a5adcbcc5
commit 3b638f4715
5 changed files with 55 additions and 8 deletions

View File

@@ -214,8 +214,8 @@ void EscenaJoc::actualitzar(float delta_time) {
num_vides_--;
if (num_vides_ > 0) {
// Respawn ship
nau_.inicialitzar(&punt_spawn_);
// Respawn ship en posición de muerte con invulnerabilidad
nau_.inicialitzar(&punt_mort_, true);
itocado_ = 0.0f;
} else {
// Game over
@@ -560,6 +560,9 @@ void EscenaJoc::tocado() {
if (itocado_ == 0.0f) {
// *** PHASE 1: TRIGGER DEATH ***
// Guardar posición de muerte para respawn
punt_mort_ = nau_.get_centre();
// Mark ship as dead (stops rendering and input)
nau_.marcar_tocada();
@@ -859,8 +862,8 @@ void EscenaJoc::detectar_col·lisions_bales_enemics() {
}
void EscenaJoc::detectar_col·lisio_nau_enemics() {
// Only check collisions if ship is alive
if (!nau_.esta_viva()) {
// Skip collisions if ship is dead or invulnerable
if (!nau_.esta_viva() || nau_.es_invulnerable()) {
return;
}

View File

@@ -56,6 +56,7 @@ class EscenaJoc {
bool game_over_; // Game over state flag
float game_over_timer_; // Countdown timer for auto-return (seconds)
Punt punt_spawn_; // Configurable spawn point
Punt punt_mort_; // Death position (for respawn)
int puntuacio_total_; // Current score
// Text vectorial