linter
This commit is contained in:
@@ -131,7 +131,7 @@ void Balloon::render() {
|
||||
// Renderizado para el resto de globos
|
||||
if (isBeingCreated()) {
|
||||
// Renderizado con transparencia
|
||||
sprite_->getTexture()->setAlpha(255 - (int)((float)creation_counter_ * (255.0F / (float)creation_counter_ini_)));
|
||||
sprite_->getTexture()->setAlpha(255 - (int)(creation_counter_ * (255.0F / creation_counter_ini_)));
|
||||
sprite_->render();
|
||||
sprite_->getTexture()->setAlpha(255);
|
||||
} else {
|
||||
@@ -142,19 +142,19 @@ void Balloon::render() {
|
||||
}
|
||||
|
||||
// Actualiza la posición y estados del globo (time-based)
|
||||
void Balloon::move(float deltaTime) {
|
||||
void Balloon::move(float delta_time) {
|
||||
if (isStopped()) {
|
||||
return;
|
||||
}
|
||||
|
||||
handleHorizontalMovement(deltaTime);
|
||||
handleVerticalMovement(deltaTime);
|
||||
applyGravity(deltaTime);
|
||||
handleHorizontalMovement(delta_time);
|
||||
handleVerticalMovement(delta_time);
|
||||
applyGravity(delta_time);
|
||||
}
|
||||
|
||||
void Balloon::handleHorizontalMovement(float deltaTime) {
|
||||
void Balloon::handleHorizontalMovement(float delta_time) {
|
||||
// DeltaTime en segundos: velocidad (pixels/s) * tempo * tiempo (s)
|
||||
x_ += vx_ * game_tempo_ * deltaTime;
|
||||
x_ += vx_ * game_tempo_ * delta_time;
|
||||
|
||||
const int CLIP = 2;
|
||||
const float MIN_X = play_area_.x - CLIP;
|
||||
@@ -165,9 +165,9 @@ void Balloon::handleHorizontalMovement(float deltaTime) {
|
||||
}
|
||||
}
|
||||
|
||||
void Balloon::handleVerticalMovement(float deltaTime) {
|
||||
void Balloon::handleVerticalMovement(float delta_time) {
|
||||
// DeltaTime en segundos: velocidad (pixels/s) * tempo * tiempo (s)
|
||||
y_ += vy_ * game_tempo_ * deltaTime;
|
||||
y_ += vy_ * game_tempo_ * delta_time;
|
||||
|
||||
if (shouldCheckTopCollision()) {
|
||||
handleTopCollision();
|
||||
@@ -222,37 +222,37 @@ void Balloon::handleBottomCollision() {
|
||||
}
|
||||
}
|
||||
|
||||
void Balloon::applyGravity(float deltaTime) {
|
||||
void Balloon::applyGravity(float delta_time) {
|
||||
// DeltaTime en segundos: aceleración (pixels/s²) * tempo * tiempo (s)
|
||||
vy_ += gravity_ * game_tempo_ * deltaTime;
|
||||
vy_ += gravity_ * game_tempo_ * delta_time;
|
||||
}
|
||||
|
||||
void Balloon::playBouncingSound() {
|
||||
void Balloon::playBouncingSound() const {
|
||||
if (sound_.enabled && sound_.bouncing_enabled) {
|
||||
Audio::get()->playSound(sound_.bouncing_file);
|
||||
}
|
||||
}
|
||||
|
||||
void Balloon::playPoppingSound() {
|
||||
void Balloon::playPoppingSound() const {
|
||||
if (sound_.enabled && sound_.poping_enabled) {
|
||||
Audio::get()->playSound(sound_.popping_file);
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza al globo a su posicion, animación y controla los contadores (time-based)
|
||||
void Balloon::update(float deltaTime) {
|
||||
move(deltaTime);
|
||||
updateState(deltaTime);
|
||||
void Balloon::update(float delta_time) {
|
||||
move(delta_time);
|
||||
updateState(delta_time);
|
||||
updateBounceEffect();
|
||||
shiftSprite();
|
||||
shiftColliders();
|
||||
sprite_->update(deltaTime);
|
||||
sprite_->update(delta_time);
|
||||
// Contador interno con deltaTime en segundos
|
||||
counter_ += deltaTime;
|
||||
counter_ += delta_time;
|
||||
}
|
||||
|
||||
// Actualiza los estados del globo (time-based)
|
||||
void Balloon::updateState(float deltaTime) {
|
||||
void Balloon::updateState(float delta_time) {
|
||||
// Si se está creando
|
||||
if (isBeingCreated()) {
|
||||
// Actualiza el valor de las variables
|
||||
@@ -262,13 +262,13 @@ void Balloon::updateState(float deltaTime) {
|
||||
if (creation_counter_ > 0) {
|
||||
// Desplaza lentamente el globo hacia abajo y hacia un lado
|
||||
// Cada 10/60 segundos (equivalente a 10 frames a 60fps)
|
||||
movement_accumulator_ += deltaTime;
|
||||
movement_accumulator_ += delta_time;
|
||||
|
||||
constexpr float MOVEMENT_INTERVAL_S = 10.0f / 60.0f; // 10 frames = ~0.167s
|
||||
constexpr float MOVEMENT_INTERVAL_S = 10.0F / 60.0F; // 10 frames = ~0.167s
|
||||
if (movement_accumulator_ >= MOVEMENT_INTERVAL_S) {
|
||||
movement_accumulator_ -= MOVEMENT_INTERVAL_S;
|
||||
y_++;
|
||||
x_ += vx_ / 60.0f; // Convierte de pixels/segundo a pixels/frame para movimiento discreto
|
||||
x_ += vx_ / 60.0F; // Convierte de pixels/segundo a pixels/frame para movimiento discreto
|
||||
|
||||
// Comprueba no se salga por los laterales
|
||||
const int MIN_X = play_area_.x;
|
||||
@@ -276,12 +276,12 @@ void Balloon::updateState(float deltaTime) {
|
||||
|
||||
if (x_ < MIN_X || x_ > MAX_X) {
|
||||
// Corrige y cambia el sentido de la velocidad
|
||||
x_ -= vx_ / 60.0f;
|
||||
x_ -= vx_ / 60.0F;
|
||||
vx_ = -vx_;
|
||||
}
|
||||
}
|
||||
creation_counter_ -= deltaTime;
|
||||
if (creation_counter_ < 0) creation_counter_ = 0;
|
||||
creation_counter_ -= delta_time;
|
||||
creation_counter_ = std::max<float>(creation_counter_, 0);
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user