forked from jaildesigner-jailgames/jaildoctors_dilemma
Trabajando con los tiles que matan
This commit is contained in:
@@ -6,12 +6,12 @@
|
||||
25,249,249,249,249,249,249,249,249,249,249,249,249,249,0,0,0,0,249,249,249,249,249,249,249,249,249,249,249,249,249,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,230,230,230,230,0,0,0,0,0,0,0,0,0,0,0,0,0,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,
|
||||
25,25,25,25,0,25,25,25,25,25,0,25,25,25,25,0,0,230,0,0,0,0,0,0,0,0,0,0,0,0,0,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,270,270,270,270,270,270,270,0,0,270,0,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,290,0,0,0,0,0,0,0,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,290,0,0,0,0,0,0,0,25,
|
||||
25,25,25,25,0,25,25,25,25,25,0,25,25,25,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,270,270,270,270,270,270,270,270,270,0,0,270,0,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,290,0,0,0,0,0,0,0,0,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,290,0,0,0,0,0,0,0,0,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,25,25,25,25,0,0,25,25,25,25,25,25,25,0,0,0,0,0,0,0,25,
|
||||
25,0,0,0,0,229,229,229,229,229,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,
|
||||
|
||||
@@ -23,6 +23,9 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, D
|
||||
|
||||
// currentRoom = "06.room";
|
||||
// spawnPoint = {14 * 8, 9 * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
||||
|
||||
currentRoom = "04.room";
|
||||
spawnPoint = {9 * 8, 11 * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
||||
// ****
|
||||
|
||||
// Crea los objetos
|
||||
|
||||
@@ -341,7 +341,6 @@ void Player::move()
|
||||
if (ly > -1)
|
||||
{
|
||||
y = ly - h;
|
||||
// setState(s_standing);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +384,6 @@ void Player::move()
|
||||
if (ry > -1)
|
||||
{
|
||||
y = ry - h;
|
||||
// setState(s_standing);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -36,7 +36,7 @@ enum tile_e
|
||||
t_passable,
|
||||
t_slope_l,
|
||||
t_slope_r,
|
||||
t_death
|
||||
t_kill
|
||||
};
|
||||
|
||||
// Clase Room
|
||||
|
||||
Reference in New Issue
Block a user