Creadas las colisiones con los enemigos
This commit is contained in:
@@ -153,6 +153,10 @@ void Game::draw()
|
||||
text = "tile: " + std::to_string(a) + " - " + std::to_string(b);
|
||||
mText->write(0, 19 * 8, text);
|
||||
|
||||
const bool collision = checkPlayerAndEnemies();
|
||||
text = "collision: " + std::to_string(collision);
|
||||
mText->write(0, 20 * 8, text);
|
||||
|
||||
// Actualiza la pantalla
|
||||
mScreen->blit();
|
||||
}
|
||||
@@ -230,7 +234,7 @@ void Game::checkPlayerOnFloor()
|
||||
const bool is_tile_aligned = mPlayer->getLeftFoot().y % 8 == 0;
|
||||
|
||||
if (((is_not_going_up) && (is_tile_aligned)) || ((is_not_going_up) && (tile_change)))
|
||||
{
|
||||
{
|
||||
bool test = false;
|
||||
test |= (mRoom->getTile(mPlayer->getLeftFoot()) == TILE_SOLID);
|
||||
test |= (mRoom->getTile(mPlayer->getRightFoot()) == TILE_SOLID);
|
||||
@@ -287,4 +291,10 @@ void Game::checkPlayerAndWalls()
|
||||
mPlayer->undoLastMove();
|
||||
mPlayer->setStatus(STATUS_FALLING);
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba las colisiones del jugador con los enemigos
|
||||
bool Game::checkPlayerAndEnemies()
|
||||
{
|
||||
return mRoom->enemyCollision(mPlayer->getCollider());
|
||||
}
|
||||
Reference in New Issue
Block a user