forked from jaildesigner-jailgames/jaildoctors_dilemma
Trabajando con los tiles que matan
This commit is contained in:
@@ -604,45 +604,14 @@ std::string Room::getRoom(int border)
|
||||
// Devuelve el tipo de tile que hay en ese pixel
|
||||
tile_e Room::getTile(SDL_Point point)
|
||||
{
|
||||
const int maxTile = mapWidth * mapHeight;
|
||||
const int pos = ((point.y / tileSize) * mapWidth) + (point.x / tileSize);
|
||||
tile_e tile = t_empty;
|
||||
|
||||
if (pos < maxTile)
|
||||
{
|
||||
// Las filas 0-7 son de tiles t_wall
|
||||
if ((tilemap[pos] >= 0) && (tilemap[pos] < 8 * tilesetWidth))
|
||||
{
|
||||
return t_wall;
|
||||
}
|
||||
|
||||
// La fila 8 es de tiles t_slope_r
|
||||
else if ((tilemap[pos] >= 8 * tilesetWidth) && (tilemap[pos] < 9 * tilesetWidth))
|
||||
{
|
||||
return t_slope_r;
|
||||
}
|
||||
|
||||
// La fila 9 es de tiles t_slope_l
|
||||
else if ((tilemap[pos] >= 9 * tilesetWidth) && (tilemap[pos] < 10 * tilesetWidth))
|
||||
{
|
||||
return t_slope_l;
|
||||
}
|
||||
|
||||
// Las filas 10-18 son de tiles t_passable
|
||||
if ((tilemap[pos] >= 10 * tilesetWidth) && (tilemap[pos] < 19 * tilesetWidth))
|
||||
{
|
||||
return t_passable;
|
||||
}
|
||||
}
|
||||
|
||||
return tile;
|
||||
return getTile(pos);
|
||||
}
|
||||
|
||||
// Devuelve el tipo de tile que hay en ese indice
|
||||
tile_e Room::getTile(int index)
|
||||
{
|
||||
const int maxTile = mapWidth * mapHeight;
|
||||
tile_e tile = t_empty;
|
||||
|
||||
if (index < maxTile)
|
||||
{
|
||||
@@ -664,14 +633,20 @@ tile_e Room::getTile(int index)
|
||||
return t_slope_l;
|
||||
}
|
||||
|
||||
// Las filas 10-18 son de tiles t_passable
|
||||
if ((tilemap[index] >= 10 * tilesetWidth) && (tilemap[index] < 19 * tilesetWidth))
|
||||
// Las filas 10-17 son de tiles t_passable
|
||||
if ((tilemap[index] >= 10 * tilesetWidth) && (tilemap[index] < 18 * tilesetWidth))
|
||||
{
|
||||
return t_passable;
|
||||
}
|
||||
|
||||
// Las fila 18 es de tiles t_kill
|
||||
if ((tilemap[index] >= 18 * tilesetWidth) && (tilemap[index] < 19 * tilesetWidth))
|
||||
{
|
||||
return t_kill;
|
||||
}
|
||||
}
|
||||
|
||||
return tile;
|
||||
return t_empty;
|
||||
}
|
||||
|
||||
// Indica si hay colision con un enemigo a partir de un rectangulo
|
||||
|
||||
Reference in New Issue
Block a user