estandaritzats els globos a 0, 1, 2 i 3 (en lloc del mix que havia antes amb altres coses a 1, 2, 3 i 4)
balloon: passant const i enum a la part publica
This commit is contained in:
@@ -12,54 +12,54 @@
|
||||
|
||||
class Texture;
|
||||
|
||||
// --- Constantes relacionadas con globos ---
|
||||
constexpr int MAX_BOUNCE = 10; // Cantidad de elementos del vector de deformación
|
||||
|
||||
constexpr std::array<int, 4> BALLOON_SCORE = {50, 100, 200, 400};
|
||||
constexpr std::array<int, 4> BALLOON_POWER = {1, 3, 7, 15};
|
||||
constexpr std::array<int, 4> BALLOON_MENACE = {1, 2, 4, 8};
|
||||
constexpr std::array<int, 5> BALLOON_SIZE = {10, 16, 26, 48, 49};
|
||||
|
||||
const std::array<std::string, 4> BALLOON_BOUNCING_SOUND = {
|
||||
"bubble1.wav", "bubble2.wav", "bubble3.wav", "bubble4.wav"};
|
||||
|
||||
const std::array<std::string, 4> BALLOON_POPPING_SOUND = {
|
||||
"balloon1.wav", "balloon2.wav", "balloon3.wav", "balloon4.wav"};
|
||||
|
||||
enum class BalloonSize : Uint8 {
|
||||
SIZE1 = 0,
|
||||
SIZE2 = 1,
|
||||
SIZE3 = 2,
|
||||
SIZE4 = 3,
|
||||
};
|
||||
|
||||
enum class BalloonType : Uint8 {
|
||||
BALLOON = 0,
|
||||
FLOATER = 1,
|
||||
POWERBALL = 2,
|
||||
};
|
||||
|
||||
constexpr float BALLOON_VELX_POSITIVE = 0.7F;
|
||||
constexpr float BALLOON_VELX_NEGATIVE = -0.7F;
|
||||
|
||||
constexpr int BALLOON_MOVING_ANIMATION = 0;
|
||||
constexpr int BALLOON_POP_ANIMATION = 1;
|
||||
constexpr int BALLOON_BORN_ANIMATION = 2;
|
||||
|
||||
constexpr std::array<float, 5> BALLOON_SPEED = {0.60F, 0.70F, 0.80F, 0.90F, 1.00F};
|
||||
|
||||
constexpr int POWERBALL_SCREENPOWER_MINIMUM = 10;
|
||||
constexpr int POWERBALL_COUNTER = 8;
|
||||
|
||||
// --- Clase Balloon ---
|
||||
class Balloon {
|
||||
public:
|
||||
// --- Constantes relacionadas con globos ---
|
||||
static constexpr int MAX_BOUNCE = 10; // Cantidad de elementos del vector de deformación
|
||||
|
||||
static constexpr std::array<int, 4> SCORE = {50, 100, 200, 400};
|
||||
static constexpr std::array<int, 4> POWER = {1, 3, 7, 15};
|
||||
static constexpr std::array<int, 4> MENACE = {1, 2, 4, 8};
|
||||
static constexpr std::array<int, 5> SIZE = {10, 16, 26, 48, 49};
|
||||
|
||||
const std::array<std::string, 4> BOUNCING_SOUND = {
|
||||
"balloon_bounce0.wav", "balloon_bounce1.wav", "balloon_bounce2.wav", "balloon_bounce3.wav"};
|
||||
|
||||
const std::array<std::string, 4> POPPING_SOUND = {
|
||||
"balloon_pop0.wav", "balloon_pop1.wav", "balloon_pop2.wav", "balloon_pop3.wav"};
|
||||
|
||||
static constexpr float VELX_POSITIVE = 0.7F;
|
||||
static constexpr float VELX_NEGATIVE = -0.7F;
|
||||
|
||||
static constexpr int MOVING_ANIMATION = 0;
|
||||
static constexpr int POP_ANIMATION = 1;
|
||||
static constexpr int BORN_ANIMATION = 2;
|
||||
|
||||
static constexpr std::array<float, 5> SPEED = {0.60F, 0.70F, 0.80F, 0.90F, 1.00F};
|
||||
|
||||
static constexpr int POWERBALL_SCREENPOWER_MINIMUM = 10;
|
||||
static constexpr int POWERBALL_COUNTER = 8;
|
||||
|
||||
enum class Size : Uint8 {
|
||||
SIZE_0 = 0,
|
||||
SIZE_1 = 1,
|
||||
SIZE_2 = 2,
|
||||
SIZE_3 = 3,
|
||||
};
|
||||
|
||||
enum class Type : Uint8 {
|
||||
BALLOON = 0,
|
||||
FLOATER = 1,
|
||||
POWERBALL = 2,
|
||||
};
|
||||
|
||||
// --- Constructores y destructor ---
|
||||
Balloon(
|
||||
float x,
|
||||
float y,
|
||||
BalloonType type,
|
||||
BalloonSize size,
|
||||
Type type,
|
||||
Size size,
|
||||
float vel_x,
|
||||
float speed,
|
||||
Uint16 creation_timer,
|
||||
@@ -86,14 +86,14 @@ class Balloon {
|
||||
[[nodiscard]] auto getPosY() const -> float { return y_; }
|
||||
[[nodiscard]] auto getWidth() const -> int { return w_; }
|
||||
[[nodiscard]] auto getHeight() const -> int { return h_; }
|
||||
[[nodiscard]] auto getSize() const -> BalloonSize { return size_; }
|
||||
[[nodiscard]] auto getType() const -> BalloonType { return type_; }
|
||||
[[nodiscard]] auto getSize() const -> Size { return size_; }
|
||||
[[nodiscard]] auto getType() const -> Type { return type_; }
|
||||
[[nodiscard]] auto getScore() const -> Uint16 { return score_; }
|
||||
auto getCollider() -> Circle & { return collider_; }
|
||||
[[nodiscard]] auto getMenace() const -> Uint8 { return isEnabled() ? menace_ : 0; }
|
||||
[[nodiscard]] auto getPower() const -> Uint8 { return power_; }
|
||||
[[nodiscard]] auto isStopped() const -> bool { return stopped_; }
|
||||
[[nodiscard]] auto isPowerBall() const -> bool { return type_ == BalloonType::POWERBALL; }
|
||||
[[nodiscard]] auto isPowerBall() const -> bool { return type_ == Type::POWERBALL; }
|
||||
[[nodiscard]] auto isInvulnerable() const -> bool { return invulnerable_; }
|
||||
[[nodiscard]] auto isBeingCreated() const -> bool { return being_created_; }
|
||||
[[nodiscard]] auto isEnabled() const -> bool { return enabled_; }
|
||||
@@ -154,8 +154,8 @@ class Balloon {
|
||||
Uint16 creation_counter_; // Temporizador de creación
|
||||
Uint16 creation_counter_ini_; // Valor inicial del temporizador de creación
|
||||
Uint16 score_; // Puntos al destruir el globo
|
||||
BalloonType type_; // Tipo de globo
|
||||
BalloonSize size_; // Tamaño de globo
|
||||
Type type_; // Tipo de globo
|
||||
Size size_; // Tamaño de globo
|
||||
Uint8 menace_; // Amenaza que genera el globo
|
||||
Uint32 counter_ = 0; // Contador interno
|
||||
float travel_y_ = 1.0F; // Distancia a recorrer en Y antes de aplicar gravedad
|
||||
|
||||
Reference in New Issue
Block a user