Added FSM and Game State Manager

This commit is contained in:
2021-02-15 21:10:18 -05:00
parent 78629be4d8
commit e4de32f9f7
8 changed files with 315 additions and 2 deletions

View File

@ -87,7 +87,7 @@ public:
sprite->Play("Idle");
if (!Game::gravityOnPlayer){
Game::gravityOnPlayer = true;
sprite->Play("Fall");
// sprite->Play("Fall");
}
break;
case SDLK_RIGHT:
@ -108,6 +108,13 @@ public:
transform->velocity.y = 0;
sprite->Play("Fall");
Game::gravityOnPlayer = true;
break;
case SDLK_u:
// Advance the GSM state via the u key
Game::gsm->AdvanceState();
break;
case SDLK_i:
Game::gsm->GameOver();
break;
case SDLK_ESCAPE: // exit the game when Escape pressed
Game::isRunning = false;