developers, developers!

This commit is contained in:
2026-04-06 15:17:19 +02:00
parent 4c5e1e5470
commit fccc27fca0
10 changed files with 55 additions and 67 deletions

View File

@@ -36,7 +36,7 @@ class Player {
static constexpr float HORIZONTAL_VELOCITY = 60.0F; // Velocidad horizontal objetivo en pixels/segundo
static constexpr float HORIZONTAL_ACCEL = 500.0F; // Aceleración/deceleración horizontal en pixels/segundo² (inercia ligera)
static constexpr float MAX_VY = 160.0F; // Velocidad vertical máxima en pixels/segundo
static constexpr float JUMP_VELOCITY = -140.0F; // Velocidad inicial del salto en pixels/segundo
static constexpr float JUMP_VELOCITY = -170.0F; // Velocidad inicial del salto en pixels/segundo
static constexpr float GRAVITY_FORCE = 360.0F; // Fuerza de gravedad en pixels/segundo²
static constexpr float LOW_JUMP_GRAVITY_MULT = 3.0F; // Multiplicador de gravedad al soltar el botón de salto (salto variable)
@@ -87,8 +87,8 @@ class Player {
private:
// --- Constantes ---
static constexpr int WIDTH = 8; // Ancho del jugador
static constexpr int HEIGHT = 16; // ALto del jugador
static constexpr int WIDTH = 12; // Ancho del jugador
static constexpr int HEIGHT = 24; // Alto del jugador
static constexpr int MAX_FALLING_HEIGHT = Tile::SIZE * 4; // Altura maxima permitida de caída en pixels
// --- Objetos y punteros ---
@@ -105,6 +105,7 @@ class Player {
Direction wanna_go_ = Direction::NONE;
bool wanna_jump_ = false;
bool wanna_down_ = false;
bool jump_held_ = false; // true mientras la tecla de salto esté pulsada (para detectar flanco)
// --- Variables de estado ---
State state_ = State::ON_GROUND; // Estado en el que se encuentra el jugador. Util apara saber si está saltando o cayendo
@@ -112,7 +113,7 @@ class Player {
// --- Variables de colisión ---
SDL_FRect collider_box_{}; // Caja de colisión con los enemigos u objetos
std::array<SDL_FPoint, 8> collider_points_{}; // Puntos de colisión con el mapa
std::array<SDL_FPoint, 12> collider_points_{}; // Puntos de colisión con el mapa (3 columnas × 4 filas, gap ≤ 8px)
SDL_FPoint under_left_foot_ = {.x = 0.0F, .y = 0.0F}; // El punto bajo la esquina inferior izquierda del jugador
SDL_FPoint under_right_foot_ = {.x = 0.0F, .y = 0.0F}; // El punto bajo la esquina inferior derecha del jugador
const LineDiagonal* current_slope_{nullptr}; // Rampa actual sobe la que está el jugador