Preparandose para añadir gravedad y colisiones y pasarle el mapa al jugador

This commit is contained in:
2022-07-06 09:10:11 +02:00
parent 4243f89dc0
commit edba97cfc7
2 changed files with 18 additions and 1 deletions

View File

@@ -301,9 +301,24 @@ std::string Room::getRoom(int border)
case BORDER_LEFT: case BORDER_LEFT:
return room_left; return room_left;
break; break;
default: default:
break; break;
} }
return ""; return "";
} }
// Dice si el tile al que pertenece el pixel es sólido o no
bool Room::isSolid(int x, int y)
{
int tile = ((y / 8) * 32) + (x / 8);
if (tile < 512)
{
if (tilemap[tile] != 0)
{
return true;
}
}
return false;
}

View File

@@ -81,6 +81,8 @@ public:
// Devuelve la cadena del fichero de la habitación contigua segun el borde // Devuelve la cadena del fichero de la habitación contigua segun el borde
std::string getRoom(int border); std::string getRoom(int border);
// Dice si el tile al que pertenece el pixel es sólido o no
bool isSolid(int x, int y);
}; };
#endif #endif