Els globos fills ja no ixen centrats al pare, si no al final havia varios apilats

This commit is contained in:
2024-11-16 12:24:20 +01:00
parent 79d25fb812
commit 065336c310

View File

@@ -160,12 +160,17 @@ void BalloonManager::createChildBalloon(const std::shared_ptr<Balloon> &balloon,
const float vx = direction == "LEFT" ? BALLOON_VELX_NEGATIVE : BALLOON_VELX_POSITIVE;
const auto lower_size = static_cast<BalloonSize>(static_cast<int>(balloon->getSize()) - 1);
auto b = createBalloon(0, balloon->getPosY(), balloon->getType(), lower_size, vx, balloon_speed_, 0);
b->alignTo(balloon->getPosX() + (balloon->getWidth() / 2));
const int x = direction == "LEFT" ? balloon->getPosX() + (balloon->getWidth() / 3) : balloon->getPosX() + 2 * (balloon->getWidth() / 3);
b->alignTo(x);
b->setVelY(b->getType() == BalloonType::BALLOON ? -2.50f : BALLOON_VELX_NEGATIVE * 2.0f);
if (balloon->isStopped())
{
b->stop();
}
if (balloon->isUsingReversedColor())
{
b->useReverseColor();
}
}
// Crea una PowerBall