Commit de vesprà tirada a la brossa
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "balloon.h"
|
||||
#include <cmath> // for abs
|
||||
#include "animated_sprite.h" // for AnimatedSprite
|
||||
#include "animated_sprite.h" // for SpriteAnimated
|
||||
#include "moving_sprite.h" // for MovingSprite
|
||||
#include "param.h" // for param
|
||||
#include "sprite.h" // for Sprite
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
// Constructor
|
||||
Balloon::Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16 creation_timer, std::shared_ptr<Texture> texture, std::vector<std::string> *animation)
|
||||
: sprite_(std::make_unique<AnimatedSprite>(texture, "", animation)),
|
||||
: sprite_(std::make_unique<AnimatedSprite>(texture, animation)),
|
||||
pos_x_(x),
|
||||
pos_y_(y),
|
||||
vel_x_(vel_x),
|
||||
@@ -217,7 +217,7 @@ Balloon::Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16
|
||||
menace_ = 0;
|
||||
|
||||
// Añade rotación al sprite_
|
||||
sprite_->setRotate(false);
|
||||
sprite_->disableRotate();
|
||||
sprite_->setRotateSpeed(0);
|
||||
vel_x_ > 0.0f ? sprite_->setRotateAmount(2.0) : sprite_->setRotateAmount(-2.0);
|
||||
|
||||
@@ -306,7 +306,7 @@ void Balloon::render()
|
||||
|
||||
if (kind_ == POWER_BALL && !isBeingCreated())
|
||||
{
|
||||
auto sp = std::make_unique<Sprite>(sprite_->getPos(), sprite_->getTexture());
|
||||
auto sp = std::make_unique<Sprite>(sprite_->getTexture(), sprite_->getPos());
|
||||
sp->setSpriteClip(BALLOON_WIDTH_4, 0, BALLOON_WIDTH_4, BALLOON_WIDTH_4);
|
||||
sp->render();
|
||||
}
|
||||
@@ -454,7 +454,7 @@ void Balloon::update()
|
||||
{
|
||||
if (enabled_)
|
||||
{
|
||||
sprite_->MovingSprite::update();
|
||||
sprite_->update();
|
||||
move();
|
||||
updateAnimation();
|
||||
updateColliders();
|
||||
@@ -510,7 +510,7 @@ void Balloon::updateState()
|
||||
setInvulnerable(false);
|
||||
if (kind_ == POWER_BALL)
|
||||
{
|
||||
sprite_->setRotate(true);
|
||||
sprite_->enableRotate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -520,7 +520,7 @@ void Balloon::updateState()
|
||||
// Si es una powerball deja de rodar
|
||||
if (kind_ == POWER_BALL)
|
||||
{
|
||||
sprite_->setRotate(false);
|
||||
sprite_->disableRotate();
|
||||
}
|
||||
|
||||
// Reduce el contador
|
||||
@@ -536,7 +536,7 @@ void Balloon::updateState()
|
||||
// Si es una powerball vuelve a rodar
|
||||
if (kind_ == POWER_BALL)
|
||||
{
|
||||
sprite_->setRotate(true);
|
||||
sprite_->enableRotate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -569,7 +569,7 @@ void Balloon::updateAnimation()
|
||||
sprite_->setCurrentAnimation(normal_animation);
|
||||
}
|
||||
|
||||
sprite_->animate();
|
||||
sprite_->update();
|
||||
}
|
||||
|
||||
// Comprueba si el globo está habilitado
|
||||
|
||||
Reference in New Issue
Block a user