forked from jaildesigner-jailgames/jaildoctors_dilemma
Seguimos con las nuevas colisiones
This commit is contained in:
@@ -30,6 +30,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input)
|
||||
ticksSpeed = 15;
|
||||
playerLives = 9;
|
||||
itemsPicked = 0;
|
||||
player->setInvincible(true);
|
||||
|
||||
section.name = SECTION_PROG_GAME;
|
||||
section.subsection = SUBSECTION_GAME_PLAY;
|
||||
@@ -221,19 +222,19 @@ void Game::renderDebugInfo()
|
||||
const int inc = debugText->getCharacterWidth() + 1;
|
||||
int line = 131;
|
||||
|
||||
text = std::to_string((int)player->x) + "," + std::to_string((int)player->y);
|
||||
text = std::to_string(player->getRect().x) + "," + std::to_string(player->getRect().y);
|
||||
debugText->write(0, line += inc, text);
|
||||
|
||||
text = "status: " + std::to_string(player->status);
|
||||
debugText->write(0, line += inc, text);
|
||||
|
||||
// text = "foot: " + std::to_string((int)player->getLeftFoot().y);
|
||||
// debugText->write(0, line += inc, text);
|
||||
text = "foot: " + std::to_string((int)player->getLeftFoot().y);
|
||||
debugText->write(0, line += inc, text);
|
||||
|
||||
// const int a = (player->lastPosition.y + 16) / 8;
|
||||
// const int b = player->getLeftFoot().y / 8;
|
||||
// text = "tile: " + std::to_string(a) + " - " + std::to_string(b);
|
||||
// debugText->write(0, line += inc, text);
|
||||
const int a = (player->lastPosition.y + 16) / 8;
|
||||
const int b = player->getLeftFoot().y / 8;
|
||||
text = "tile: " + std::to_string(a) + " - " + std::to_string(b);
|
||||
debugText->write(0, line += inc, text);
|
||||
|
||||
const bool collision = checkPlayerAndEnemies();
|
||||
text = "collision: " + std::to_string(collision);
|
||||
@@ -313,6 +314,11 @@ void Game::checkPlayerAndItems()
|
||||
// Mata al jugador
|
||||
void Game::killPlayer()
|
||||
{
|
||||
if (player->getInvincible())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
playerLives--;
|
||||
|
||||
// Destruye la habitacion y el jugador
|
||||
|
||||
Reference in New Issue
Block a user