diff --git a/source/game/scenes/game.cpp b/source/game/scenes/game.cpp index f1abde7..c5b83f5 100644 --- a/source/game/scenes/game.cpp +++ b/source/game/scenes/game.cpp @@ -492,12 +492,20 @@ void Game::handleDebugMouseDrag(float delta_time) { float dy = game_y - player_y; float distance = std::sqrt(dx * dx + dy * dy); - // Velocidad de movimiento hacia el cursor (pixels/segundo) - constexpr float DRAG_SPEED = 300.0F; + // Constantes de velocidad con ease-in (aceleración progresiva) + constexpr float DRAG_SPEED_MIN = 30.0F; // Velocidad inicial (pixels/segundo) + constexpr float DRAG_SPEED_MAX = 600.0F; // Velocidad máxima (pixels/segundo) + constexpr float DRAG_ACCELERATION = 600.0F; // Aceleración (pixels/segundo²) + + // Incrementar velocidad con el tiempo (ease-in) + if (!debug_dragging_player_) { + debug_drag_speed_ = DRAG_SPEED_MIN; // Iniciar con velocidad mínima + } + debug_drag_speed_ = std::min(DRAG_SPEED_MAX, debug_drag_speed_ + DRAG_ACCELERATION * delta_time); if (distance > 1.0F) { - // Calcular el movimiento con aceleración (interpolación suave) - float move_factor = std::min(1.0F, DRAG_SPEED * delta_time / distance); + // Calcular el movimiento con la velocidad actual + float move_factor = std::min(1.0F, debug_drag_speed_ * delta_time / distance); float new_x = player_x + dx * move_factor; float new_y = player_y + dy * move_factor; @@ -512,6 +520,7 @@ void Game::handleDebugMouseDrag(float delta_time) { // Botón soltado después de arrastrar: finalizar teleport player_->finalizeDebugTeleport(); debug_dragging_player_ = false; + debug_drag_speed_ = 0.0F; // Reset para el próximo arrastre } } #endif diff --git a/source/game/scenes/game.hpp b/source/game/scenes/game.hpp index b6f5683..f30e04a 100644 --- a/source/game/scenes/game.hpp +++ b/source/game/scenes/game.hpp @@ -130,5 +130,6 @@ class Game { #ifdef _DEBUG // Variables de debug para arrastre con ratón bool debug_dragging_player_{false}; // Indica si estamos arrastrando al jugador con el ratón + float debug_drag_speed_{0.0F}; // Velocidad actual del arrastre (ease-in) #endif }; \ No newline at end of file