Trabajando en las nuevas pantallas
This commit is contained in:
@@ -7,7 +7,7 @@ Map::Map(std::string file, SDL_Renderer *renderer, Asset *asset, ItemTracker *it
|
||||
tile_size = 8;
|
||||
map_width = 40;
|
||||
map_height = 26;
|
||||
tileset_width = 32;
|
||||
tileset_width = 34;
|
||||
name = file.substr(file.find_last_of("\\/") + 1);
|
||||
enemy_file = "";
|
||||
bgColor1 = bgColor2 = {0, 0, 0};
|
||||
@@ -422,15 +422,14 @@ e_tile_map Map::getTile(SDL_Point p)
|
||||
|
||||
// Calcula el tile
|
||||
const int tile = tilemap[((y / tile_size) * map_width) + (x / tile_size)];
|
||||
const int png_width = 32;
|
||||
|
||||
// Las 8 primeras filas son tiles de fondo
|
||||
if (tile >= 0 && tile < 8 * png_width)
|
||||
if (tile >= 0 && tile < 8 * tileset_width)
|
||||
{
|
||||
return nothing;
|
||||
}
|
||||
// De la fila 8 a la 15 hay tiles de muro
|
||||
else if (tile >= (8 * png_width) && tile < 16 * png_width)
|
||||
else if (tile >= (8 * tileset_width) && tile < 16 * tileset_width)
|
||||
{
|
||||
return wall;
|
||||
}
|
||||
@@ -511,6 +510,12 @@ std::string Map::getRoomFileName(e_border border)
|
||||
return "";
|
||||
}
|
||||
|
||||
// Devuelve el nombre del fichero de la habitación
|
||||
std::string Map::getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
// Indica si hay colision con un actor a partir de un rectangulo
|
||||
int Map::actorCollision(SDL_Rect &rect)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user