ColliderComponent hidden prop

This commit is contained in:
2021-08-16 17:36:21 -04:00
parent 8713b76f83
commit 1e5beb5b88
11 changed files with 30 additions and 134 deletions

View File

@ -282,6 +282,18 @@ void Game::update()
camera.x = map->width-camera.w;
if (camera.y > map->height-camera.h)
camera.y = map->height-camera.h;
if (Game::debugCollisionBoxes)
{
for (auto& c: colliders)
{
c->getComponent<ColliderComponent>().hidden = false;
}
} else {
for (auto& c: colliders)
{
c->getComponent<ColliderComponent>().hidden = true;
}
}
}
void Game::render()
@ -295,14 +307,12 @@ void Game::render()
{
t->draw();
}
if (Game::debugCollisionBoxes)
for (auto& c : colliders)
{
for (auto& c : colliders)
{
c->draw();
}
c->draw();
}
for (auto& o : objects)
{
o->draw();