Firefighter better animations added

This commit is contained in:
2021-01-31 02:10:02 -05:00
parent 697ab6f8fc
commit 3481c20e4f
11 changed files with 75 additions and 44 deletions

View File

@ -34,39 +34,39 @@ public:
switch (Game::event.key.keysym.sym)
{
case SDLK_UP:
transform->velocity.y = -1;
// transform->velocity.y = -1;
// sprite->Play("WalkNorth");
if (transform->velocity.x < 0)
{
// if (transform->velocity.x < 0)
// {
// sprite->Play("WalkNW");
}
if (transform->velocity.x > 0)
{
// }
// if (transform->velocity.x > 0)
// {
// sprite->Play("WalkNW");
// sprite->spriteFlip = SDL_FLIP_HORIZONTAL;
}
// }
break;
case SDLK_DOWN:
transform->velocity.y = 1;
// transform->velocity.y = 1;
// sprite->Play("WalkSouth");
if (transform->velocity.x < 0)
{
// if (transform->velocity.x < 0)
// {
// sprite->Play("WalkSW");
}
if (transform->velocity.x > 0)
{
// }
// if (transform->velocity.x > 0)
// {
// sprite->Play("WalkSW");
// sprite->spriteFlip = SDL_FLIP_HORIZONTAL;
}
// }
break;
case SDLK_LEFT:
transform->velocity.x = -1;
// sprite->Play("Walk");
sprite->Play("Walk");
sprite->spriteFlip = SDL_FLIP_NONE;
break;
case SDLK_RIGHT:
transform->velocity.x = 1;
// sprite->Play("Walk");
sprite->Play("Walk");
sprite->spriteFlip = SDL_FLIP_HORIZONTAL;
break;
case SDLK_k:
@ -77,6 +77,9 @@ public:
{
Mix_PlayChannel(-1, Game::assets->GetSoundClip("bwoop"),0);
}
Game::gravityOnPlayer = true;
sprite->Play("Jump");
transform->velocity.y = -1;
break;
default:
break;
@ -99,11 +102,11 @@ public:
break;
case SDLK_LEFT:
transform->velocity.x = 0;
// sprite->Play("idle");
sprite->Play("Idle");
break;
case SDLK_RIGHT:
transform->velocity.x = 0;
// sprite->Play("idle");
sprite->Play("Idle");
break;
case SDLK_k:
if (Game::debugCollisionBoxes)
@ -111,6 +114,11 @@ public:
else
{Game::debugCollisionBoxes = true; }
break;
case SDLK_j:
transform->velocity.y = 0;
sprite->Play("Fall");
Game::gravityOnPlayer = true;
break;
case SDLK_ESCAPE: // exit the game when Escape pressed
Game::isRunning = false;
break;