fix: SHAPE mode - regenerar figuras automáticamente al cambiar escenario
PROBLEMA RESUELTO: En modo SHAPE (figuras 3D), al cambiar el número de pelotas (teclas 1-8), las nuevas pelotas aparecían en pantalla pero NO formaban la figura hasta pulsar de nuevo la tecla de figura (Q/W/E/R/T). CAUSA RAÍZ: 1. changeScenario() creaba pelotas nuevas en centro de pantalla 2. generateShape() generaba puntos target de la figura 3. PERO las pelotas nuevas no tenían shape_attraction_active=true 4. Sin atracción activa, las pelotas no se movían hacia sus targets CAMBIOS IMPLEMENTADOS: 1. Ball class (ball.h/ball.cpp): - Constructor ahora acepta parámetro Y explícito - Eliminado hardcodeo Y=0.0f en inicialización de pos_ 2. SceneManager (scene_manager.cpp): - PHYSICS mode: Y = 0.0f (parte superior, comportamiento original) - SHAPE mode: Y = screen_height_/2.0f (centro vertical) ✅ - BOIDS mode: Y = rand() (posición Y aleatoria) - Ball constructor llamado con parámetro Y según modo 3. Engine (engine.cpp:514-521): - Tras generateShape(), activar enableShapeAttraction(true) en todas las pelotas nuevas - Garantiza que las pelotas converjan inmediatamente hacia figura RESULTADO: ✅ Cambiar escenario (1-8) en modo SHAPE regenera automáticamente la figura ✅ No requiere pulsar tecla de figura de nuevo ✅ Transición suave e inmediata hacia nueva configuración ARCHIVOS MODIFICADOS: - source/ball.h: Constructor acepta parámetro Y - source/ball.cpp: Usar Y en lugar de hardcode 0.0f - source/scene/scene_manager.cpp: Inicializar Y según SimulationMode - source/engine.cpp: Activar shape attraction tras changeScenario() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -31,7 +31,7 @@ class Ball {
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Ball(float x, float vx, float vy, Color color, std::shared_ptr<Texture> texture, int screen_width, int screen_height, int ball_size, GravityDirection gravity_dir = GravityDirection::DOWN, float mass_factor = 1.0f);
|
||||
Ball(float x, float y, float vx, float vy, Color color, std::shared_ptr<Texture> texture, int screen_width, int screen_height, int ball_size, GravityDirection gravity_dir = GravityDirection::DOWN, float mass_factor = 1.0f);
|
||||
|
||||
// Destructor
|
||||
~Ball() = default;
|
||||
|
||||
Reference in New Issue
Block a user