La powerball ja no mata

La powerball no pillava la rotació si es creava amb el rellotge actiu
This commit is contained in:
2024-11-16 12:45:58 +01:00
parent 065336c310
commit da74b8dfce
5 changed files with 38 additions and 65 deletions

View File

@@ -64,8 +64,7 @@ Balloon::Balloon(float x, float y, BalloonType type, BalloonSize size, float vel
gravity_ = param.balloon.at(index).grav;
default_vy_ = param.balloon.at(index).vel;
sprite_->disableRotate();
sprite_->setRotateSpeed(0);
sprite_->setRotate(creation_timer <= 0);
sprite_->setRotateAmount(vx_ > 0.0f ? 2.0 : -2.0);
break;
@@ -312,16 +311,20 @@ void Balloon::setAnimation()
void Balloon::stop()
{
stopped_ = true;
if (type_ == BalloonType::POWERBALL)
sprite_->disableRotate();
if (isPowerBall())
{
sprite_->setRotate(!stopped_);
}
}
// Pone el globo en movimiento
void Balloon::start()
{
stopped_ = false;
if (type_ == BalloonType::POWERBALL)
sprite_->enableRotate();
if (isPowerBall())
{
sprite_->setRotate(!stopped_);
}
}
// Alinea el circulo de colisión con la posición del objeto globo
@@ -396,27 +399,4 @@ void Balloon::useNormalColor()
{
use_reversed_colors_ = false;
setAnimation();
}
// Getters
float Balloon::getPosX() const { return x_; }
float Balloon::getPosY() const { return y_; }
int Balloon::getWidth() const { return w_; }
int Balloon::getHeight() const { return h_; }
BalloonSize Balloon::getSize() const { return size_; }
BalloonType Balloon::getType() const { return type_; }
Uint16 Balloon::getScore() const { return score_; }
Circle &Balloon::getCollider() { return collider_; }
Uint8 Balloon::getMenace() const { return isEnabled() ? menace_ : 0; }
Uint8 Balloon::getPower() const { return power_; }
bool Balloon::isStopped() const { return stopped_; }
bool Balloon::isInvulnerable() const { return invulnerable_; }
bool Balloon::isBeingCreated() const { return being_created_; }
bool Balloon::isEnabled() const { return enabled_; }
bool Balloon::isUsingReversedColor() { return use_reversed_colors_; }
bool Balloon::canBePopped() const { return !isBeingCreated(); }
// Setters
void Balloon::setVelY(float vel_y) { vy_ = vel_y; }
void Balloon::setSpeed(float speed) { speed_ = speed; }
void Balloon::setInvulnerable(bool value) { invulnerable_ = value; }
}