acabat INIT_HUD
This commit is contained in:
@@ -245,9 +245,15 @@ void EscenaJoc::actualitzar(float delta_time) {
|
||||
|
||||
switch (estat) {
|
||||
case StageSystem::EstatStage::INIT_HUD: {
|
||||
// Update stage manager timer
|
||||
// Update stage manager timer (pot canviar l'estat!)
|
||||
stage_manager_->actualitzar(delta_time);
|
||||
|
||||
// [FIX] Si l'estat ha canviat durant actualitzar(), sortir immediatament
|
||||
// per evitar recalcular la posició de la nau amb el nou timer
|
||||
if (stage_manager_->get_estat() != StageSystem::EstatStage::INIT_HUD) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Calcular progrés de l'animació de la nau
|
||||
float ship_progress = 1.0f - (stage_manager_->get_timer_transicio() /
|
||||
Defaults::Game::INIT_HUD_DURATION);
|
||||
@@ -258,10 +264,24 @@ void EscenaJoc::actualitzar(float delta_time) {
|
||||
(Defaults::Game::INIT_HUD_SHIP_DURATION / Defaults::Game::INIT_HUD_DURATION);
|
||||
ship_anim_progress = std::min(1.0f, ship_anim_progress);
|
||||
|
||||
// [DEBUG] Imprimir progrés i posició cada 10 frames
|
||||
static int debug_frame_count = 0;
|
||||
if (++debug_frame_count % 10 == 0) {
|
||||
std::cout << "[INIT_HUD] timer=" << stage_manager_->get_timer_transicio()
|
||||
<< " ship_progress=" << ship_progress
|
||||
<< " ship_anim_progress=" << ship_anim_progress
|
||||
<< " condition=" << (ship_anim_progress < 1.0f ? "TRUE" : "FALSE")
|
||||
<< " pos.y=" << nau_.get_centre().y
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
// Actualitzar posició de la nau segons animació
|
||||
if (ship_anim_progress < 1.0f) {
|
||||
Punt pos_animada = calcular_posicio_nau_init_hud(ship_anim_progress);
|
||||
std::cout << "[INIT_HUD] SETTING pos.y=" << pos_animada.y << std::endl; // [DEBUG]
|
||||
nau_.set_centre(pos_animada);
|
||||
} else {
|
||||
std::cout << "[INIT_HUD] SKIPPING update (progress >= 1.0)" << std::endl; // [DEBUG]
|
||||
}
|
||||
|
||||
// Una vegada l'animació acaba, permetre control normal
|
||||
@@ -270,7 +290,14 @@ void EscenaJoc::actualitzar(float delta_time) {
|
||||
break;
|
||||
}
|
||||
|
||||
case StageSystem::EstatStage::LEVEL_START:
|
||||
case StageSystem::EstatStage::LEVEL_START: {
|
||||
// [DEBUG] Log entrada a LEVEL_START
|
||||
static bool first_entry = true;
|
||||
if (first_entry) {
|
||||
std::cout << "[LEVEL_START] ENTERED with pos.y=" << nau_.get_centre().y << std::endl;
|
||||
first_entry = false;
|
||||
}
|
||||
|
||||
// Update countdown timer
|
||||
stage_manager_->actualitzar(delta_time);
|
||||
|
||||
@@ -286,6 +313,7 @@ void EscenaJoc::actualitzar(float delta_time) {
|
||||
// [NEW] Update debris
|
||||
debris_manager_.actualitzar(delta_time);
|
||||
break;
|
||||
}
|
||||
|
||||
case StageSystem::EstatStage::PLAYING: {
|
||||
// [NEW] Update stage manager (spawns enemies, pass pause flag)
|
||||
|
||||
Reference in New Issue
Block a user