la IA havia trencat el recorregut de la lluna

This commit is contained in:
2025-08-14 12:20:34 +02:00
parent a13e024934
commit ea7628259a

View File

@@ -498,14 +498,22 @@ void Background::createMoonPath() {
const float CENTER_Y = base_ - 50; const float CENTER_Y = base_ - 50;
constexpr float RADIUS = 140; constexpr float RADIUS = 140;
// Generar puntos de la curva desde 0 a 90 grados
constexpr double STEP = 0.01; constexpr double STEP = 0.01;
const int NUM_STEPS = static_cast<int>((M_PI / 2 - 0) / STEP) + 1; const int NUM_STEPS = static_cast<int>((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<int>(NUM_STEPS * (1.0f - FREEZE_PERCENTAGE));
for (int i = 0; i < NUM_STEPS; ++i) { 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 x = CENTER_X + (RADIUS * cos(theta));
float y = CENTER_Y - (RADIUS * sin(theta)); float y = CENTER_Y - (RADIUS * sin(theta));
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}); moon_path_.push_back({x, y});
} }
} }
}