magic numbers: item.cpp

This commit is contained in:
2025-09-22 13:14:23 +02:00
parent 91b26631c6
commit 9edfe6877f
2 changed files with 36 additions and 21 deletions

View File

@@ -31,6 +31,23 @@ class Item {
static constexpr int COFFEE_MACHINE_HEIGHT = 39; // Altura de la máquina de café
static constexpr float LIFETIME_DURATION_MS = 10000.0f; // Duración de vida del ítem (600 frames a 60fps)
// Velocidades base (pixels/ms) - Coffee Machine
static constexpr float COFFEE_MACHINE_VEL_X_FACTOR = 0.03F; // Factor para velocidad X de máquina de café
static constexpr float COFFEE_MACHINE_VEL_Y = -0.006F; // Velocidad Y inicial de máquina de café
static constexpr float COFFEE_MACHINE_ACCEL_Y = 0.00036F; // Aceleración Y de máquina de café (pixels/ms²)
// Velocidades base (pixels/ms) - Items normales (del plan: vel_x: ±1.0F→±0.06F, vel_y: -4.0F→-0.24F, accel_y: 0.2F→0.012F)
static constexpr float ITEM_VEL_X_BASE = 0.06F; // Velocidad X base para items (1.0F/16.67)
static constexpr float ITEM_VEL_X_STEP = 0.02F; // Incremento de velocidad X (0.33F/16.67)
static constexpr float ITEM_VEL_Y = -0.24F; // Velocidad Y inicial de items (-4.0F/16.67)
static constexpr float ITEM_ACCEL_Y = 0.00072F; // Aceleración Y de items (pixels/ms²) - 0.2F * (60/1000)²
// Constantes de física de rebote
static constexpr float BOUNCE_VEL_THRESHOLD = 0.06F; // Umbral de velocidad para parar (1.0F/16.67)
static constexpr float COFFEE_BOUNCE_DAMPING = -0.20F; // Factor de rebote Y para máquina de café
static constexpr float ITEM_BOUNCE_DAMPING = -0.5F; // Factor de rebote Y para items normales
static constexpr float HORIZONTAL_DAMPING = 0.75F; // Factor de amortiguación horizontal
// --- Constructor y destructor ---
Item(ItemType type, float x, float y, SDL_FRect &play_area, const std::shared_ptr<Texture> &texture, const std::vector<std::string> &animation); // Constructor principal
~Item() = default; // Destructor