Afegits estats al fade

Afegida opció de prefade
El modo demo ja comença a meitat del "meollo"
This commit is contained in:
2025-01-04 13:40:22 +01:00
parent 06eb05f065
commit 7b8f16610a
9 changed files with 139 additions and 86 deletions

View File

@@ -42,7 +42,7 @@ Title::Title()
mini_logo_sprite_->setX(param.game.game_area.center_x - mini_logo_sprite_->getWidth() / 2);
fade_->setColor(fade_color.r, fade_color.g, fade_color.b);
fade_->setType(FadeType::RANDOM_SQUARE);
fade_->setPost(param.fade.post_duration);
fade_->setPostDuration(param.fade.post_duration);
Resource::get()->getTexture("smb2.gif")->setPalette(1);
// Asigna valores a otras variables
@@ -79,14 +79,16 @@ void Title::update()
fade_->update();
if (fade_->hasEnded())
{
if (post_fade_ == -1)
if (selection_ == section::Options::TITLE_TIME_OUT)
{
// El menu ha hecho time out
section::name = next_section_;
}
else
{
// Se ha pulsado para jugar
section::name = section::Name::GAME;
section::options = post_fade_ == 1 ? section::Options::GAME_PLAY_1P : section::Options::GAME_PLAY_2P;
section::options = selection_;
JA_StopMusic();
}
}
@@ -122,8 +124,10 @@ void Title::update()
if (counter_ == param.title.title_duration)
{
// El menu ha hecho time out
fade_->setPostDuration(0);
fade_->activate();
post_fade_ = -1;
selection_ = section::Options::TITLE_TIME_OUT;
}
break;
@@ -295,7 +299,18 @@ void Title::checkInput()
{
JA_PlaySound(Resource::get()->getSound("game_start.wav"));
JA_FadeOutMusic(1500);
post_fade_ = controller.player_id;
switch (controller.player_id)
{
case 1:
selection_ = section::Options::GAME_PLAY_1P;
break;
case 2:
selection_ = section::Options::GAME_PLAY_2P;
break;
default:
selection_ = section::Options::TITLE_TIME_OUT;
break;
}
state_ = TitleState::START_HAS_BEEN_PRESSED;
counter_ = 0;
return;