fix: no inicialitzava be animated_sprite

This commit is contained in:
2025-09-22 10:03:38 +02:00
parent d4a0189dc8
commit 5e3946e28b
2 changed files with 17 additions and 2 deletions

View File

@@ -202,6 +202,12 @@ void AnimatedSprite::loadFromAnimationsFileBuffer(const AnimationsFileBuffer& so
// Pone un valor por defecto
setWidth(config.frame_width);
setHeight(config.frame_height);
// Establece el primer frame inmediatamente si hay animaciones
if (!animations_.empty()) {
current_animation_ = 0;
updateSpriteClip();
}
}
// Procesa una línea de configuración

View File

@@ -89,6 +89,12 @@ Balloon::Balloon(const Config& config)
// Establece la animación a usar
setAnimation();
// Si no se está creando (creation_counter = 0), asegurar estado activo
if (!being_created_) {
start();
setInvulnerable(false);
}
}
// Centra el globo en la posición X
@@ -308,11 +314,14 @@ void Balloon::setAnimation() {
}
// Establece el frame de animación
std::string chosen_animation;
if (use_reversed_colors_) {
sprite_->setCurrentAnimation(creating_animation);
chosen_animation = creating_animation;
} else {
sprite_->setCurrentAnimation(isBeingCreated() ? creating_animation : normal_animation);
chosen_animation = isBeingCreated() ? creating_animation : normal_animation;
}
sprite_->setCurrentAnimation(chosen_animation);
}
// Detiene el globo