INIT_HUD amb temps de les animacions per percentatge
ordenats en subcarpetes els fitxers d'audio corregit typo LIFES a LIVES
This commit is contained in:
@@ -260,28 +260,13 @@ void EscenaJoc::actualitzar(float delta_time) {
|
||||
ship_progress = std::min(1.0f, ship_progress);
|
||||
|
||||
// Calcular quant ha avançat l'animació de la nau
|
||||
float ship_anim_progress = ship_progress /
|
||||
(Defaults::Game::INIT_HUD_SHIP_DURATION / Defaults::Game::INIT_HUD_DURATION);
|
||||
float ship_anim_progress = ship_progress / Defaults::Game::INIT_HUD_SHIP_RATIO;
|
||||
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
|
||||
@@ -415,18 +400,15 @@ void EscenaJoc::dibuixar() {
|
||||
float global_progress = 1.0f - (timer / total_time);
|
||||
|
||||
// Progrés del rectangle (empieza inmediatament)
|
||||
float rect_progress = global_progress /
|
||||
(Defaults::Game::INIT_HUD_RECT_DURATION / total_time);
|
||||
float rect_progress = global_progress / Defaults::Game::INIT_HUD_RECT_RATIO;
|
||||
rect_progress = std::min(1.0f, rect_progress);
|
||||
|
||||
// Progrés del marcador (empieza inmediatament)
|
||||
float score_progress = global_progress /
|
||||
(Defaults::Game::INIT_HUD_SCORE_DURATION / total_time);
|
||||
float score_progress = global_progress / Defaults::Game::INIT_HUD_SCORE_RATIO;
|
||||
score_progress = std::min(1.0f, score_progress);
|
||||
|
||||
// Progrés de la nau (empieza inmediatament)
|
||||
float ship_progress = global_progress /
|
||||
(Defaults::Game::INIT_HUD_SHIP_DURATION / total_time);
|
||||
float ship_progress = global_progress / Defaults::Game::INIT_HUD_SHIP_RATIO;
|
||||
ship_progress = std::min(1.0f, ship_progress);
|
||||
|
||||
// Dibuixar elements animats
|
||||
@@ -634,7 +616,7 @@ void EscenaJoc::dibuixar_marcador() {
|
||||
std::string score_str = std::to_string(puntuacio_total_);
|
||||
score_str = std::string(5 - std::min(5, static_cast<int>(score_str.length())), '0') + score_str;
|
||||
|
||||
std::string text = "SCORE: " + score_str + " LIFES: " + std::to_string(num_vides_) +
|
||||
std::string text = "SCORE: " + score_str + " LIVES: " + std::to_string(num_vides_) +
|
||||
" LEVEL: " + stage_str;
|
||||
|
||||
// Paràmetres de renderització
|
||||
@@ -733,7 +715,7 @@ void EscenaJoc::dibuixar_marcador_animat(float progress) {
|
||||
std::string score_str = std::to_string(puntuacio_total_);
|
||||
score_str = std::string(5 - std::min(5, static_cast<int>(score_str.length())), '0') + score_str;
|
||||
|
||||
std::string text = "SCORE: " + score_str + " LIFES: " + std::to_string(num_vides_) +
|
||||
std::string text = "SCORE: " + score_str + " LIVES: " + std::to_string(num_vides_) +
|
||||
" LEVEL: " + stage_str;
|
||||
|
||||
// Calcular dimensions
|
||||
|
||||
@@ -281,7 +281,7 @@ void EscenaLogo::actualitzar(float delta_time) {
|
||||
|
||||
// Reproduir so quan la lletra comença a aparèixer (progress > 0)
|
||||
if (letra_progress > 0.0f) {
|
||||
Audio::get()->playSound("logo.wav", Audio::Group::INTERFACE);
|
||||
Audio::get()->playSound(Defaults::Sound::LOGO, Audio::Group::GAME);
|
||||
so_reproduit_[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,14 +110,7 @@ void StageManager::canviar_estat(EstatStage nou_estat) {
|
||||
void StageManager::processar_init_hud(float delta_time) {
|
||||
timer_transicio_ -= delta_time;
|
||||
|
||||
// [DEBUG] Imprimir timer cada 10 frames
|
||||
static int debug_frame_count = 0;
|
||||
if (++debug_frame_count % 10 == 0) {
|
||||
std::cout << "[processar_init_hud] timer=" << timer_transicio_ << std::endl;
|
||||
}
|
||||
|
||||
if (timer_transicio_ <= 0.0f) {
|
||||
std::cout << "[processar_init_hud] TRANSICIÓ a LEVEL_START!" << std::endl; // [DEBUG]
|
||||
canviar_estat(EstatStage::LEVEL_START);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user