canvis en el inici i final de fase
This commit is contained in:
@@ -233,8 +233,20 @@ void EscenaJoc::actualitzar(float delta_time) {
|
||||
|
||||
switch (estat) {
|
||||
case StageSystem::EstatStage::LEVEL_START:
|
||||
// Frozen gameplay, countdown timer only
|
||||
// Update countdown timer
|
||||
stage_manager_->actualitzar(delta_time);
|
||||
|
||||
// [NEW] Allow ship movement and shooting during intro
|
||||
nau_.processar_input(delta_time);
|
||||
nau_.actualitzar(delta_time);
|
||||
|
||||
// [NEW] Update bullets
|
||||
for (auto& bala : bales_) {
|
||||
bala.actualitzar(delta_time);
|
||||
}
|
||||
|
||||
// [NEW] Update debris
|
||||
debris_manager_.actualitzar(delta_time);
|
||||
break;
|
||||
|
||||
case StageSystem::EstatStage::PLAYING: {
|
||||
@@ -271,8 +283,20 @@ void EscenaJoc::actualitzar(float delta_time) {
|
||||
}
|
||||
|
||||
case StageSystem::EstatStage::LEVEL_COMPLETED:
|
||||
// Frozen gameplay, countdown timer only
|
||||
// Update countdown timer
|
||||
stage_manager_->actualitzar(delta_time);
|
||||
|
||||
// [NEW] Allow ship movement and shooting during outro
|
||||
nau_.processar_input(delta_time);
|
||||
nau_.actualitzar(delta_time);
|
||||
|
||||
// [NEW] Update bullets (allow last shots to continue)
|
||||
for (auto& bala : bales_) {
|
||||
bala.actualitzar(delta_time);
|
||||
}
|
||||
|
||||
// [NEW] Update debris (from last destroyed enemies)
|
||||
debris_manager_.actualitzar(delta_time);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -318,6 +342,20 @@ void EscenaJoc::dibuixar() {
|
||||
|
||||
switch (estat) {
|
||||
case StageSystem::EstatStage::LEVEL_START:
|
||||
// [NEW] Draw ship if alive
|
||||
if (itocado_ == 0.0f) {
|
||||
nau_.dibuixar();
|
||||
}
|
||||
|
||||
// [NEW] Draw bullets
|
||||
for (const auto& bala : bales_) {
|
||||
bala.dibuixar();
|
||||
}
|
||||
|
||||
// [NEW] Draw debris
|
||||
debris_manager_.dibuixar();
|
||||
|
||||
// [EXISTING] Draw intro message and score
|
||||
dibuixar_missatge_stage(StageSystem::Constants::MISSATGE_LEVEL_START);
|
||||
dibuixar_marcador();
|
||||
break;
|
||||
@@ -341,6 +379,20 @@ void EscenaJoc::dibuixar() {
|
||||
break;
|
||||
|
||||
case StageSystem::EstatStage::LEVEL_COMPLETED:
|
||||
// [NEW] Draw ship if alive
|
||||
if (itocado_ == 0.0f) {
|
||||
nau_.dibuixar();
|
||||
}
|
||||
|
||||
// [NEW] Draw bullets (allow last shots to be visible)
|
||||
for (const auto& bala : bales_) {
|
||||
bala.dibuixar();
|
||||
}
|
||||
|
||||
// [NEW] Draw debris (from last destroyed enemies)
|
||||
debris_manager_.dibuixar();
|
||||
|
||||
// [EXISTING] Draw completion message and score
|
||||
dibuixar_missatge_stage(StageSystem::Constants::MISSATGE_LEVEL_COMPLETED);
|
||||
dibuixar_marcador();
|
||||
break;
|
||||
@@ -603,7 +655,7 @@ void EscenaJoc::dibuixar_missatge_stage(const std::string& missatge) {
|
||||
|
||||
const SDL_FRect& play_area = Defaults::Zones::PLAYAREA;
|
||||
float x = play_area.x + (play_area.w - text_width) / 2.0f;
|
||||
float y = play_area.y + (play_area.h - text_height) / 2.0f;
|
||||
float y = play_area.y + (play_area.h * 0.25f) - (text_height / 2.0f);
|
||||
|
||||
Punt pos = {static_cast<float>(x), static_cast<float>(y)};
|
||||
text_.render(missatge, pos, escala, spacing);
|
||||
|
||||
Reference in New Issue
Block a user