This commit is contained in:
2025-10-27 13:01:11 +01:00
parent 5d8811026d
commit cdb9bde6aa
23 changed files with 392 additions and 392 deletions

View File

@@ -63,12 +63,12 @@ struct PlayerData {
};
class Player {
public:
private:
// Constantes
static constexpr int WIDTH_ = 8; // Ancho del jugador
static constexpr int HEIGHT_ = 16; // ALto del jugador
static constexpr int MAX_FALLING_HEIGHT_ = BLOCK * 4; // Altura maxima permitida de caída.
static constexpr float MAX_VY_ = 1.2f; // Velocidad máxima que puede alcanzar al desplazarse en vertical
static constexpr int WIDTH = 8; // Ancho del jugador
static constexpr int HEIGHT = 16; // ALto del jugador
static constexpr int MAX_FALLING_HEIGHT = BLOCK * 4; // Altura maxima permitida de caída.
static constexpr float MAX_VY = 1.2F; // Velocidad máxima que puede alcanzar al desplazarse en vertical
// Objetos y punteros
std::shared_ptr<Room> room_; // Objeto encargado de gestionar cada habitación del juego
@@ -170,7 +170,7 @@ class Player {
void renderDebugInfo();
#endif
public:
public:
// Constructor
explicit Player(const PlayerData& player);
@@ -184,16 +184,16 @@ class Player {
void update();
// Indica si el jugador esta en uno de los cuatro bordes de la pantalla
bool getOnBorder() { return is_on_border_; }
bool getOnBorder() const { return is_on_border_; }
// Indica en cual de los cuatro bordes se encuentra
RoomBorder getBorder() { return border_; }
RoomBorder getBorder() const { return border_; }
// Cambia al jugador de un borde al opuesto. Util para el cambio de pantalla
void switchBorders();
// Obtiene el rectangulo que delimita al jugador
SDL_FRect getRect() { return {x_, y_, WIDTH_, HEIGHT_}; }
SDL_FRect getRect() { return {x_, y_, WIDTH, HEIGHT}; }
// Obtiene el rectangulo de colision del jugador
SDL_FRect& getCollider() { return collider_box_; }
@@ -208,7 +208,7 @@ class Player {
void setRoom(std::shared_ptr<Room> room) { room_ = room; }
// Comprueba si el jugador esta vivo
bool isAlive() { return is_alive_; }
bool isAlive() const { return is_alive_; }
// Pone el jugador en modo pausa
void setPaused(bool value) { is_paused_ = value; }