Revisant la classe Balloon
This commit is contained in:
@@ -11,17 +11,6 @@ class Texture;
|
||||
// Cantidad de elementos del vector con los valores de la deformación del globo al rebotar
|
||||
constexpr int MAX_BOUNCE = 10;
|
||||
|
||||
// Tipos de globo
|
||||
constexpr int BALLOON_1 = 1;
|
||||
constexpr int BALLOON_2 = 2;
|
||||
constexpr int BALLOON_3 = 3;
|
||||
constexpr int BALLOON_4 = 4;
|
||||
constexpr int HEXAGON_1 = 5;
|
||||
constexpr int HEXAGON_2 = 6;
|
||||
constexpr int HEXAGON_3 = 7;
|
||||
constexpr int HEXAGON_4 = 8;
|
||||
constexpr int POWER_BALL = 9;
|
||||
|
||||
// Puntos de globo
|
||||
constexpr int BALLOON_SCORE_1 = 50;
|
||||
constexpr int BALLOON_SCORE_2 = 100;
|
||||
@@ -29,14 +18,21 @@ constexpr int BALLOON_SCORE_3 = 200;
|
||||
constexpr int BALLOON_SCORE_4 = 400;
|
||||
|
||||
// Tamaños de globo
|
||||
constexpr int BALLOON_SIZE_1 = 1;
|
||||
constexpr int BALLOON_SIZE_2 = 2;
|
||||
constexpr int BALLOON_SIZE_3 = 3;
|
||||
constexpr int BALLOON_SIZE_4 = 4;
|
||||
enum class BalloonSize : Uint8
|
||||
{
|
||||
SIZE1 = 0,
|
||||
SIZE2 = 1,
|
||||
SIZE3 = 2,
|
||||
SIZE4 = 3,
|
||||
};
|
||||
|
||||
// Clases de globo
|
||||
constexpr int BALLOON_CLASS = 0;
|
||||
constexpr int HEXAGON_CLASS = 1;
|
||||
enum class BalloonType : Uint8
|
||||
{
|
||||
BALLOON = 0,
|
||||
HEXAGON = 1,
|
||||
POWERBALL = 2,
|
||||
};
|
||||
|
||||
// Velocidad del globo
|
||||
constexpr float BALLOON_VELX_POSITIVE = 0.7f;
|
||||
@@ -106,12 +102,12 @@ private:
|
||||
Uint16 creation_counter_ini_; // Valor inicial para el temporizador para controlar el estado "creandose"
|
||||
Uint16 score_; // Puntos que da el globo al ser destruido
|
||||
Uint16 stopped_counter_ = 0; // Contador para controlar el estado "parado"
|
||||
Uint8 kind_; // Tipo de globo
|
||||
BalloonType type_; // Clase de globo
|
||||
BalloonSize size_; // Tamaño del globo
|
||||
Uint8 menace_; // Cantidad de amenaza que genera el globo
|
||||
Uint32 counter_ = 0; // Contador interno
|
||||
float travel_y_ = 1.0f; // Distancia que ha de recorrer el globo en el eje Y antes de que se le aplique la gravedad
|
||||
float speed_; // Velocidad a la que se mueven los globos
|
||||
Uint8 size_; // Tamaño del globo
|
||||
Uint8 power_; // Cantidad de poder que alberga el globo
|
||||
Bouncing bouncing_; // Contiene las variables para el efecto de rebote
|
||||
|
||||
@@ -138,7 +134,7 @@ private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16 creation_timer, std::shared_ptr<Texture> texture, const std::vector<std::string> &animation);
|
||||
Balloon(float x, float y, BalloonType type, BalloonSize size, float vel_x, float speed, Uint16 creation_timer, std::shared_ptr<Texture> texture, const std::vector<std::string> &animation);
|
||||
|
||||
// Destructor
|
||||
~Balloon() = default;
|
||||
@@ -185,14 +181,11 @@ public:
|
||||
// Establece el valor de la variable
|
||||
void setSpeed(float speed);
|
||||
|
||||
// Obtiene del valor de la variable
|
||||
int getKind() const;
|
||||
// Obtiene el tamaño del globo
|
||||
BalloonSize getSize() const;
|
||||
|
||||
// Obtiene del valor de la variable
|
||||
Uint8 getSize() const;
|
||||
|
||||
// Obtiene la clase a la que pertenece el globo
|
||||
Uint8 getClass() const;
|
||||
// Obtiene el tipo de globo
|
||||
BalloonType getType() const;
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setStop(bool value);
|
||||
|
||||
Reference in New Issue
Block a user