From ea7628259a7c6aa9dda8a6c25dfc6dcfe2e42ad3 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 14 Aug 2025 12:20:34 +0200 Subject: [PATCH] la IA havia trencat el recorregut de la lluna --- source/background.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/source/background.cpp b/source/background.cpp index 07a12d5..275ca47 100644 --- a/source/background.cpp +++ b/source/background.cpp @@ -498,14 +498,22 @@ void Background::createMoonPath() { const float CENTER_Y = base_ - 50; constexpr float RADIUS = 140; - // Generar puntos de la curva desde 0 a 90 grados constexpr double STEP = 0.01; - const int NUM_STEPS = static_cast((M_PI / 2 - 0) / STEP) + 1; + const int NUM_STEPS = static_cast((M_PI / 2) / STEP) + 1; + + constexpr float FREEZE_PERCENTAGE = 0.2f; // Porcentaje final del recorrido que se mantiene fijo + + const int FREEZE_START_INDEX = static_cast(NUM_STEPS * (1.0f - FREEZE_PERCENTAGE)); for (int i = 0; i < NUM_STEPS; ++i) { - double theta = 0 + i * STEP; + double theta = i * STEP; float x = CENTER_X + (RADIUS * cos(theta)); float y = CENTER_Y - (RADIUS * sin(theta)); - moon_path_.push_back({x, y}); + + if (i >= FREEZE_START_INDEX && !moon_path_.empty()) { + moon_path_.push_back(moon_path_.back()); // Repite el último punto válido + } else { + moon_path_.push_back({x, y}); + } } -} \ No newline at end of file +}