Ya funcionan los tiles atravesables

This commit is contained in:
2022-07-10 21:10:45 +02:00
parent bade27edc4
commit 8d49c78519
5 changed files with 58 additions and 26 deletions

View File

@@ -308,18 +308,24 @@ std::string Room::getRoom(int border)
return "";
}
// Indica si el tile al que pertenece el pixel es sólido o no
bool Room::isFloor(SDL_Point point)
// Devuelve el tipo de tile que hay en ese pixel
int Room::getTile(SDL_Point point)
{
int tile = ((point.y / 8) * 32) + (point.x / 8);
if (tile < 512)
int pos = ((point.y / 8) * 32) + (point.x / 8);
int tile = TILE_EMPTY;
if (pos < 512)
{
if (tilemap[tile] != 0)
if (tilemap[pos] == 41)
{
return true;
return TILE_SOLID;
}
if (tilemap[pos] == 81)
{
return TILE_TRAVESSABLE;
}
}
return false;
return tile;
}