layout de TITOL
This commit is contained in:
@@ -323,22 +323,19 @@ void EscenaJoc::actualitzar(float delta_time) {
|
||||
}
|
||||
|
||||
// Calcular global progress (0.0 al inicio → 1.0 al final)
|
||||
float global_progress = 1.0f - (stage_manager_->get_timer_transicio() /
|
||||
Defaults::Game::INIT_HUD_DURATION);
|
||||
float global_progress = 1.0f - (stage_manager_->get_timer_transicio() / Defaults::Game::INIT_HUD_DURATION);
|
||||
global_progress = std::min(1.0f, global_progress);
|
||||
|
||||
// [NEW] Calcular progress independiente para cada nave
|
||||
float ship1_progress = calcular_progress_rango(
|
||||
global_progress,
|
||||
Defaults::Game::INIT_HUD_SHIP1_RATIO_INIT,
|
||||
Defaults::Game::INIT_HUD_SHIP1_RATIO_END
|
||||
);
|
||||
Defaults::Game::INIT_HUD_SHIP1_RATIO_END);
|
||||
|
||||
float ship2_progress = calcular_progress_rango(
|
||||
global_progress,
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_INIT,
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_END
|
||||
);
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_END);
|
||||
|
||||
// [MODIFICAT] Animar AMBAS naus con sus progress respectivos
|
||||
if (config_partida_.jugador1_actiu && ship1_progress < 1.0f) {
|
||||
@@ -501,26 +498,22 @@ void EscenaJoc::dibuixar() {
|
||||
float rect_progress = calcular_progress_rango(
|
||||
global_progress,
|
||||
Defaults::Game::INIT_HUD_RECT_RATIO_INIT,
|
||||
Defaults::Game::INIT_HUD_RECT_RATIO_END
|
||||
);
|
||||
Defaults::Game::INIT_HUD_RECT_RATIO_END);
|
||||
|
||||
float score_progress = calcular_progress_rango(
|
||||
global_progress,
|
||||
Defaults::Game::INIT_HUD_SCORE_RATIO_INIT,
|
||||
Defaults::Game::INIT_HUD_SCORE_RATIO_END
|
||||
);
|
||||
Defaults::Game::INIT_HUD_SCORE_RATIO_END);
|
||||
|
||||
float ship1_progress = calcular_progress_rango(
|
||||
global_progress,
|
||||
Defaults::Game::INIT_HUD_SHIP1_RATIO_INIT,
|
||||
Defaults::Game::INIT_HUD_SHIP1_RATIO_END
|
||||
);
|
||||
Defaults::Game::INIT_HUD_SHIP1_RATIO_END);
|
||||
|
||||
float ship2_progress = calcular_progress_rango(
|
||||
global_progress,
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_INIT,
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_END
|
||||
);
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_END);
|
||||
|
||||
// Dibuixar elements animats
|
||||
if (rect_progress > 0.0f) {
|
||||
@@ -643,15 +636,15 @@ void EscenaJoc::tocado(uint8_t player_id) {
|
||||
Punt vel_nau_80 = {vel_nau.x * 0.8f, vel_nau.y * 0.8f};
|
||||
|
||||
debris_manager_.explotar(
|
||||
naus_[player_id].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
|
||||
naus_[player_id].get_brightness(), // Heredar brightness
|
||||
vel_nau_80, // Heredar 80% velocitat
|
||||
0.0f, // Nave: trayectorias rectas (sin drotacio)
|
||||
0.0f // Sin herencia visual (rotación aleatoria)
|
||||
naus_[player_id].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
|
||||
naus_[player_id].get_brightness(), // Heredar brightness
|
||||
vel_nau_80, // Heredar 80% velocitat
|
||||
0.0f, // Nave: trayectorias rectas (sin drotacio)
|
||||
0.0f // Sin herencia visual (rotación aleatoria)
|
||||
);
|
||||
|
||||
Audio::get()->playSound(Defaults::Sound::EXPLOSION, Audio::Group::GAME);
|
||||
@@ -863,7 +856,7 @@ std::string EscenaJoc::construir_marcador() const {
|
||||
// Nivell (2 dígits)
|
||||
uint8_t stage_num = stage_manager_->get_stage_actual();
|
||||
std::string stage_str = (stage_num < 10) ? "0" + std::to_string(stage_num)
|
||||
: std::to_string(stage_num);
|
||||
: std::to_string(stage_num);
|
||||
|
||||
// Puntuació P2 (6 dígits) - mostrar zeros si inactiu
|
||||
std::string score_p2;
|
||||
@@ -946,15 +939,15 @@ void EscenaJoc::detectar_col·lisions_bales_enemics() {
|
||||
// 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_brightness(), // Heredar brightness
|
||||
vel_enemic, // Heredar velocitat
|
||||
enemic.get_drotacio(), // Heredar velocitat angular (trayectorias curvas)
|
||||
0.0f // Sin herencia visual (rotación aleatoria)
|
||||
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
|
||||
enemic.get_drotacio(), // Heredar velocitat angular (trayectorias curvas)
|
||||
0.0f // Sin herencia visual (rotación aleatoria)
|
||||
);
|
||||
|
||||
// 3. Desactivar bala
|
||||
@@ -1063,8 +1056,8 @@ void EscenaJoc::dibuixar_missatge_stage(const std::string& missatge) {
|
||||
|
||||
// Auto-scale if text exceeds max width
|
||||
float escala = (text_width_at_base <= max_width)
|
||||
? escala_base
|
||||
: max_width / text_width_at_base;
|
||||
? escala_base
|
||||
: max_width / text_width_at_base;
|
||||
|
||||
// Recalculate dimensions with final scale (using FULL message for centering)
|
||||
float full_text_width = text_.get_text_width(missatge, escala, spacing);
|
||||
@@ -1099,8 +1092,7 @@ Punt EscenaJoc::obtenir_punt_spawn(uint8_t player_id) const {
|
||||
|
||||
return {
|
||||
zona.x + zona.w * x_ratio,
|
||||
zona.y + zona.h * Defaults::Game::SPAWN_Y_RATIO
|
||||
};
|
||||
zona.y + zona.h * Defaults::Game::SPAWN_Y_RATIO};
|
||||
}
|
||||
|
||||
void EscenaJoc::disparar_bala(uint8_t player_id) {
|
||||
|
||||
Reference in New Issue
Block a user