Tiles que matan hecho
This commit is contained in:
@@ -139,6 +139,7 @@ void Player::update()
|
||||
animate(); // Establece la animación del jugador
|
||||
checkBorders(); // Comprueba si está situado en alguno de los cuatro bordes de la habitación
|
||||
checkJumpEnd(); // Comprueba si ha finalizado el salto al alcanzar la altura de inicio
|
||||
checkKillingTiles(); // Comprueba que el jugador no toque ningun tile de los que matan
|
||||
}
|
||||
|
||||
// Comprueba las entradas y modifica variables
|
||||
@@ -568,21 +569,24 @@ bool Player::isOnDownSlope()
|
||||
return onSlope;
|
||||
}
|
||||
|
||||
// Comprueba que el jugador no atraviese ninguna pared
|
||||
bool Player::checkWalls()
|
||||
// Comprueba que el jugador no toque ningun tile de los que matan
|
||||
bool Player::checkKillingTiles()
|
||||
{
|
||||
// Actualiza los puntos de colisión
|
||||
updateColliderPoints();
|
||||
|
||||
// Comprueba si ha colisionado con un muro
|
||||
bool wall = false;
|
||||
// Comprueba si hay contacto
|
||||
bool check = false;
|
||||
|
||||
for (auto c : colliderPoints)
|
||||
{
|
||||
wall |= (room->getTile(c) == t_wall);
|
||||
check |= (room->getTile(c) == t_kill);
|
||||
}
|
||||
|
||||
return wall;
|
||||
// Mata al jugador si hay colisión
|
||||
alive = !check;
|
||||
|
||||
return check;
|
||||
}
|
||||
|
||||
// Obtiene algunos parametros del jugador
|
||||
|
||||
@@ -106,8 +106,8 @@ public:
|
||||
// Comprueba si el jugador está sobre una rampa hacia abajo
|
||||
bool isOnDownSlope();
|
||||
|
||||
// Comprueba que el jugador no atraviese ninguna pared
|
||||
bool checkWalls();
|
||||
// Comprueba que el jugador no toque ningun tile de los que matan
|
||||
bool checkKillingTiles();
|
||||
|
||||
// Actualiza los puntos de colisión
|
||||
void updateColliderPoints();
|
||||
|
||||
@@ -633,14 +633,14 @@ tile_e Room::getTile(int index)
|
||||
return t_slope_l;
|
||||
}
|
||||
|
||||
// Las filas 10-17 son de tiles t_passable
|
||||
if ((tilemap[index] >= 10 * tilesetWidth) && (tilemap[index] < 18 * tilesetWidth))
|
||||
// Las filas 10-18 son de tiles t_passable
|
||||
if ((tilemap[index] >= 10 * tilesetWidth) && (tilemap[index] < 19 * tilesetWidth))
|
||||
{
|
||||
return t_passable;
|
||||
}
|
||||
|
||||
// Las fila 18 es de tiles t_kill
|
||||
if ((tilemap[index] >= 18 * tilesetWidth) && (tilemap[index] < 19 * tilesetWidth))
|
||||
// Las fila 19 es de tiles t_kill
|
||||
if ((tilemap[index] >= 19 * tilesetWidth) && (tilemap[index] < 20 * tilesetWidth))
|
||||
{
|
||||
return t_kill;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user