es pot definir el color dels globos (dels 4 colors disponibles) al fitxer de parametres

This commit is contained in:
2025-07-12 21:16:07 +02:00
parent ccce96c731
commit e882a22b3c
9 changed files with 105 additions and 65 deletions

View File

@@ -43,14 +43,19 @@ title.title_c_c_position 80 # Posición Y del título principal
background.attenuate_color FFFFFF00 # Color de atenuación del fondo (RGBA hexadecimal)
## --- BALLOONS ---
balloon_1.vel 2.75f # Velocidad inicial del globo 1
balloon_1.grav 0.09f # Gravedad aplicada al globo 1
balloon_2.vel 3.70f # Velocidad inicial del globo 2
balloon_2.grav 0.10f # Gravedad aplicada al globo 2
balloon_3.vel 4.70f # Velocidad inicial del globo 3
balloon_3.grav 0.10f # Gravedad aplicada al globo 3
balloon_4.vel 5.45f # Velocidad inicial del globo 4
balloon_4.grav 0.10f # Gravedad aplicada al globo 4
balloon.settings[0].vel 2.75f # Velocidad inicial del globo 1
balloon.settings[0].grav 0.09f # Gravedad aplicada al globo 1
balloon.settings[1].vel 3.70f # Velocidad inicial del globo 2
balloon.settings[1].grav 0.10f # Gravedad aplicada al globo 2
balloon.settings[2].vel 4.70f # Velocidad inicial del globo 3
balloon.settings[2].grav 0.10f # Gravedad aplicada al globo 3
balloon.settings[3].vel 5.45f # Velocidad inicial del globo 4
balloon.settings[3].grav 0.10f # Gravedad aplicada al globo 4
balloon.color[0] blue # Color de creación del globo normal
balloon.color[1] orange # Color del globo normal
balloon.color[2] red # Color de creación del globo que rebota
balloon.color[3] green # Color del globo que rebota
## --- NOTIFICATION ---
notification.pos_v TOP # Posición vertical de la notificación (TOP/BOTTOM)

View File

@@ -43,14 +43,19 @@ title.title_c_c_position 80 # Posición Y del título principal
background.attenuate_color FFFFFF00 # Color de atenuación del fondo (RGBA hexadecimal)
## --- BALLOONS ---
balloon_1.vel 2.75f # Velocidad inicial del globo 1
balloon_1.grav 0.09f # Gravedad aplicada al globo 1
balloon_2.vel 3.70f # Velocidad inicial del globo 2
balloon_2.grav 0.10f # Gravedad aplicada al globo 2
balloon_3.vel 4.70f # Velocidad inicial del globo 3
balloon_3.grav 0.10f # Gravedad aplicada al globo 3
balloon_4.vel 5.45f # Velocidad inicial del globo 4
balloon_4.grav 0.10f # Gravedad aplicada al globo 4
balloon.settings[0].vel 2.75f # Velocidad inicial del globo 1
balloon.settings[0].grav 0.09f # Gravedad aplicada al globo 1
balloon.settings[1].vel 3.70f # Velocidad inicial del globo 2
balloon.settings[1].grav 0.10f # Gravedad aplicada al globo 2
balloon.settings[2].vel 4.70f # Velocidad inicial del globo 3
balloon.settings[2].grav 0.10f # Gravedad aplicada al globo 3
balloon.settings[3].vel 5.45f # Velocidad inicial del globo 4
balloon.settings[3].grav 0.10f # Gravedad aplicada al globo 4
balloon.color[0] blue # Color de creación del globo normal
balloon.color[1] orange # Color del globo normal
balloon.color[2] red # Color de creación del globo que rebota
balloon.color[3] green # Color del globo que rebota
## --- NOTIFICATION ---
notification.pos_v TOP # Posición vertical de la notificación (TOP/BOTTOM)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -32,8 +32,8 @@ Balloon::Balloon(float x, float y, BalloonType type, BalloonSize size, float vel
max_vy_ = 3.0f;
const int index = static_cast<int>(size_);
gravity_ = param.balloon.at(index).grav;
default_vy_ = param.balloon.at(index).vel;
gravity_ = param.balloon.settings.at(index).grav;
default_vy_ = param.balloon.settings.at(index).vel;
h_ = w_ = BALLOON_SIZE[index];
power_ = BALLOON_POWER[index];
menace_ = BALLOON_MENACE[index];
@@ -67,8 +67,8 @@ Balloon::Balloon(float x, float y, BalloonType type, BalloonSize size, float vel
vy_ = 0;
max_vy_ = 3.0f;
gravity_ = param.balloon.at(index).grav;
default_vy_ = param.balloon.at(index).vel;
gravity_ = param.balloon.settings.at(index).grav;
default_vy_ = param.balloon.settings.at(index).vel;
sprite_->setRotate(creation_timer <= 0);
sprite_->setRotateAmount(vx_ > 0.0f ? 2.0 : -2.0);
@@ -301,12 +301,12 @@ void Balloon::setAnimation()
normal_animation = "powerball";
break;
case BalloonType::FLOATER:
creating_animation = "red";
normal_animation = "green";
creating_animation = param.balloon.color.at(2);
normal_animation = param.balloon.color.at(3);
break;
default:
creating_animation = "blue";
normal_animation = "orange";
creating_animation = param.balloon.color.at(0);
normal_animation = param.balloon.color.at(1);
break;
}

View File

@@ -58,10 +58,15 @@ void initParam()
param.background.attenuate_color = Color(255, 255, 255, 0);
// BALLOONS
param.balloon.emplace_back(0.09f, 2.60f);
param.balloon.emplace_back(0.10f, 3.50f);
param.balloon.emplace_back(0.10f, 4.50f);
param.balloon.emplace_back(0.10f, 4.95f);
param.balloon.settings.at(0) = ParamBalloon::Settings(0.09f, 2.60f);
param.balloon.settings.at(1) = ParamBalloon::Settings(0.10f, 3.50f);
param.balloon.settings.at(2) = ParamBalloon::Settings(0.10f, 4.50f);
param.balloon.settings.at(3) = ParamBalloon::Settings(0.10f, 4.95f);
param.balloon.color.at(0) = "blue";
param.balloon.color.at(1) = "orange";
param.balloon.color.at(2) = "red";
param.balloon.color.at(3) = "green";
// NOTIFICATION
param.notification.pos_v = NotifyPosition::TOP;
@@ -296,44 +301,64 @@ bool setParams(const std::string &var, const std::string &value)
}
// BALLOON
else if (var == "balloon_1.vel")
else if (var == "balloon.settings[0].vel")
{
param.balloon.at(0).vel = std::stof(value);
param.balloon.settings.at(0).vel = std::stof(value);
}
else if (var == "balloon_1.grav")
else if (var == "balloon.settings[0].grav")
{
param.balloon.at(0).grav = std::stof(value);
param.balloon.settings.at(0).grav = std::stof(value);
}
else if (var == "balloon_2.vel")
else if (var == "balloon.settings[1].vel")
{
param.balloon.at(1).vel = std::stof(value);
param.balloon.settings.at(1).vel = std::stof(value);
}
else if (var == "balloon_2.grav")
else if (var == "balloon.settings[1].grav")
{
param.balloon.at(1).grav = std::stof(value);
param.balloon.settings.at(1).grav = std::stof(value);
}
else if (var == "balloon_3.vel")
else if (var == "balloon.settings[2].vel")
{
param.balloon.at(2).vel = std::stof(value);
param.balloon.settings.at(2).vel = std::stof(value);
}
else if (var == "balloon_3.grav")
else if (var == "balloon.settings[2].grav")
{
param.balloon.at(2).grav = std::stof(value);
param.balloon.settings.at(2).grav = std::stof(value);
}
else if (var == "balloon_4.vel")
else if (var == "balloon.settings[3].vel")
{
param.balloon.at(3).vel = std::stof(value);
param.balloon.settings.at(3).vel = std::stof(value);
}
else if (var == "balloon_4.grav")
else if (var == "balloon.settings[3].grav")
{
param.balloon.at(3).grav = std::stof(value);
param.balloon.settings.at(3).grav = std::stof(value);
}
else if (var == "balloon.color[0]")
{
param.balloon.color.at(0) = value;
}
else if (var == "balloon.color[1]")
{
param.balloon.color.at(1) = value;
}
else if (var == "balloon.color[2]")
{
param.balloon.color.at(2) = value;
}
else if (var == "balloon.color[3]")
{
param.balloon.color.at(3) = value;
}
// NOTIFICACIONES

View File

@@ -46,15 +46,21 @@ struct ParamBackground
Color attenuate_color; // Color para atenuar el fondo
};
// --- Parámetros de los globos (balloons) ---
// --- Parámetros de los globos ---
struct ParamBalloon
{
struct Settings
{
float grav; // Aceleración en el eje Y. Modifica la velocidad
float vel; // Velocidad inicial al rebotar contra el suelo
// Constructor
explicit ParamBalloon(float grav_val = 0.0f, float vel_val = 0.0f)
explicit Settings(float grav_val = 0.0f, float vel_val = 0.0f)
: grav(grav_val), vel(vel_val) {}
};
std::array<Settings, 4> settings;
std::array<std::string, 4> color;
};
// --- Parámetros de las notificaciones ---
@@ -118,7 +124,7 @@ struct Param
ParamScoreboard scoreboard; // Rectángulo del marcador
ParamTitle title; // Parámetros de la pantalla de título
ParamBackground background; // Parámetros del fondo
std::vector<ParamBalloon> balloon; // Parámetros de los globos
ParamBalloon balloon; // Parámetros de los globos
ParamNotification notification; // Parámetros de las notificaciones
ParamServiceMenu service_menu; // Parámetros del menú de servicio
ParamIntro intro; // Parámetros de la intro
@@ -126,10 +132,9 @@ struct Param
ParamResource resource; // Parámetros para Resource
// Constructor
Param() : game(), fade(), scoreboard(), title(), background(), notification()
{
balloon.reserve(4);
}
Param()
: game(), fade(), scoreboard(), title(), background(), balloon(),
notification(), service_menu(), intro(), debug(), resource() {}
};
// --- Variable global con los parámetros del juego ---