Treballan en la Intro

This commit is contained in:
2025-03-12 13:39:48 +01:00
parent 5ccd7eebcd
commit 215ce999c2
3 changed files with 154 additions and 104 deletions

View File

@@ -15,13 +15,9 @@ std::vector<SDL_Point> createPath(int start, int end, PathType type, int fixed_p
double t = static_cast<double>(i) / (steps - 1);
double value = start + (end - start) * easingFunction(t);
if (start > 0 && end < 0)
if ((start > 0 && end < 0) || (start < 0 && end > 0))
{
value = start - std::abs(end - start) * easingFunction(t);
}
else if (start < 0 && end > 0)
{
value = start + std::abs(end - start) * easingFunction(t);
value = start + (end > 0 ? 1 : -1) * std::abs(end - start) * easingFunction(t);
}
switch (type)
@@ -105,8 +101,8 @@ void PathSprite::enable()
// Establece la posición
auto &path = paths_.at(current_path_);
const auto &p = path.spots.at(path.counter);
setPosition(p);
const auto &P = path.spots.at(path.counter);
setPosition(P);
}
// Coloca el sprite en los diferentes puntos del recorrido