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

@ -47,6 +47,8 @@ auto& uiInfo(manager.addEntity());
bool Game::debugCollisionBoxes = false;
bool Game::gravityOnPlayer = true;
int gScale = 0;
Game::Game() {
@ -108,7 +110,7 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
SDL_Rect myDestRect = SDL_Rect();
myDestRect.x = 12;
myDestRect.y = 8;
myDestRect.w = 140;
myDestRect.w = 120;
myDestRect.h = 40;
my9Slice = new UINineSlice("textBox");
my9Slice->MakeSlices("textBox",32,32,14,17,14,17,myDestRect,globalScale);
@ -179,10 +181,21 @@ void Game::update()
SDL_Rect cCol = c->getComponent<ColliderComponent>().collider;
if(Collision::AABB(cCol, playerCol))
{
player.getComponent<TransformComponent>().position = playerPos;
// printf("Collision detected!\n");
// player.getComponent<TransformComponent>().position = playerPos;
gravityOnPlayer = false;
// player.getComponent<SpriteComponent>().Play("Idle");
}
// while(Collision::AABB(cCol, playerCol))
// {
// gravityOnPlayer = false;
// }
}
// Gravity
if (gravityOnPlayer){
player.getComponent<TransformComponent>().position.y += 5;
}
// for(auto& p: projectiles)
// {
// if(Collision::AABB(player.getComponent<ColliderComponent>().collider, p->getComponent<ColliderComponent>().collider))

View File

@ -37,6 +37,7 @@ public:
// static std::vector<ColliderComponent*> colliders;
static bool isRunning;
static bool debugCollisionBoxes;
static bool gravityOnPlayer;
static SDL_Rect camera;
static AssetManager* assets;
enum groupLabels : std::size_t