Colisiones casi acabadas

This commit is contained in:
2022-09-04 19:43:43 +02:00
parent 1351943c79
commit 796a31a099
3 changed files with 138 additions and 142 deletions

View File

@@ -6,7 +6,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input)
// Inicia variables
clock = SDL_GetTicks();
currentRoom = "01.room";
spawnPoint = {2 * 8, 12 * 8, 0, 0, 0, STATUS_STANDING, SDL_FLIP_NONE};
spawnPoint = {2 * 8, 12 * 8, 0, 0, 0, s_standing, SDL_FLIP_NONE};
debug = true;
// Copia los punteros
@@ -222,22 +222,13 @@ void Game::renderDebugInfo()
const int inc = debugText->getCharacterWidth() + 1;
int line = 131;
text = std::to_string(player->getRect().x) + "," + std::to_string(player->getRect().y);
text = "X = " + std::to_string((int)player->x) + ", Y = " + std::to_string((int)player->y);
debugText->write(0, line += inc, text);
text = "status: " + std::to_string(player->status);
text = "VX = " + std::to_string(player->vx) + ", VY = " + std::to_string(player->vy);
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 bool collision = checkPlayerAndEnemies();
text = "collision: " + std::to_string(collision);
text = "STATE = " + std::to_string(player->state);
debugText->write(0, line += inc, text);
}