afegit segon jugador

This commit is contained in:
2025-12-10 17:18:34 +01:00
parent aca1f5200b
commit 087b8d346d
9 changed files with 304 additions and 182 deletions

View File

@@ -45,19 +45,19 @@ class EscenaJoc {
Effects::GestorPuntuacioFlotant gestor_puntuacio_;
// Estat del joc
Nau nau_;
std::array<Nau, 2> naus_; // [0]=P1, [1]=P2
std::array<Enemic, Constants::MAX_ORNIS> orni_;
std::array<Bala, Constants::MAX_BALES> bales_;
std::array<Bala, Constants::MAX_BALES * 2> bales_; // 6 balas: P1=[0,1,2], P2=[3,4,5]
Poligon chatarra_cosmica_;
float itocado_; // Death timer (seconds)
std::array<float, 2> itocado_per_jugador_; // Death timers per player (seconds)
// Lives and game over system
int num_vides_; // Current lives count
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
std::array<int, 2> vides_per_jugador_; // [0]=P1, [1]=P2
bool game_over_; // Game over state flag
float game_over_timer_; // Countdown timer for auto-return (seconds)
Punt punt_spawn_; // Configurable spawn point (legacy)
Punt punt_mort_; // Death position (for respawn, legacy)
std::array<int, 2> puntuacio_per_jugador_; // [0]=P1, [1]=P2
// Text vectorial
Graphics::VectorText text_;
@@ -67,11 +67,13 @@ class EscenaJoc {
std::unique_ptr<StageSystem::StageManager> stage_manager_;
// Funcions privades
void tocado();
void tocado(uint8_t player_id);
void detectar_col·lisions_bales_enemics(); // Col·lisions bala-enemic
void detectar_col·lisio_nau_enemics(); // Ship-enemy collision detection
void detectar_col·lisio_naus_enemics(); // Ship-enemy collision detection (plural)
void dibuixar_marges() const; // Dibuixar vores de la zona de joc
void dibuixar_marcador(); // Dibuixar marcador de puntuació
void disparar_bala(uint8_t player_id); // Shoot bullet from player
Punt obtenir_punt_spawn(uint8_t player_id) const; // Get spawn position for player
// [NEW] Stage system helpers
void dibuixar_missatge_stage(const std::string& missatge);