Ya sube cuestas pero no las baja

This commit is contained in:
2022-09-05 23:22:49 +02:00
parent b6cfe45872
commit ce8a4a8050
7 changed files with 156 additions and 43 deletions

View File

@@ -15,24 +15,29 @@
#ifndef ROOM_H
#define ROOM_H
#define TILE_EMPTY 0
#define TILE_SOLID 1
#define TILE_TRAVESSABLE 2
#define TILE_KILL 3
/*
Cada habitación se crea y destruye cada vez que se entra o sale de la misma
Cada habitacion si que tendra lo siguiente:
ID (numerico)
NOMBRE (texto)
COLOR DE FONDO (texto)
SET DE TILES (texto, hace referencia a un png de la colección)
LIMITE SUPERIOR (ID de la habitación superior), INFERIOR, IZQUIERDO y DERECHO
MAPA DE TILES (array con los indices de los tiles a utilizar) <-- hay que decidir si cada tile del set ya
tierne propiedades o se ponen en un mapa aparte
LISTADO DE ENEMIGOS (tipo, posicion, dx, dy)
LISTADO DE ITEMS (tipo, posicion)
Cada habitacion tiene lo siguiente:
- ID (numerico)
- NOMBRE (texto)
- COLOR DE FONDO (texto)
- COLOR DEL BORDE (texto)
- SET DE TILES (texto, hace referencia a un png de la colección)
- LIMITE SUPERIOR (ID de la habitación superior), INFERIOR, IZQUIERDO y DERECHO
- MAPA DE TILES (array con los indices de los tiles a utilizar) <-- hay que decidir si cada tile del set ya
tierne propiedades o se ponen en un mapa aparte
- LISTADO DE ENEMIGOS (tipo, posicion, dx, dy)
- LISTADO DE ITEMS (tipo, posicion)
*/
enum tile_e
{
t_empty,
t_wall,
t_passable,
t_slope_l,
t_slope_r,
t_death
};
// Clase Room
class Room
@@ -58,6 +63,11 @@ private:
JA_Sound itemSound; // Sonido producido al coger un objeto
int *itemsPicked; // Puntero a la cantidad de items recogidos que lleva el juego
int tileSize; // Ancho del tile en pixels
int mapWidth; // Ancho del mapa en tiles
int mapHeight; // Alto del mapa en tiles
int tilesetWidth; // Ancho del tileset en tiles
// Carga las variables desde un fichero
bool load(std::string file_path);
@@ -102,7 +112,7 @@ public:
std::string getRoom(int border);
// Devuelve el tipo de tile que hay en ese pixel
int getTile(SDL_Point point);
tile_e getTile(SDL_Point point);
// Indica si hay colision con un enemigo a partir de un rectangulo
bool enemyCollision(SDL_Rect &rect);
@@ -115,6 +125,10 @@ public:
// Obten el tamaño del tile
int getTileSize();
// Obten la coordenada de la cuesta a partir de un punto perteneciente a ese tile
int getSlopeHeight(SDL_Point p, tile_e slope);
};
#endif