revisat background, game_logo, smart sprite, tiled_bg

This commit is contained in:
2025-09-23 09:00:00 +02:00
parent 1a6ef79466
commit dd13a2bd7c
9 changed files with 54 additions and 118 deletions

View File

@@ -7,7 +7,7 @@ void SmartSprite::update(float deltaTime) {
if (enabled_) {
MovingSprite::update(deltaTime);
checkMove();
checkFinished();
checkFinished(deltaTime);
}
}
@@ -71,16 +71,19 @@ void SmartSprite::checkMove() {
}
}
// Comprueba si ha terminado
void SmartSprite::checkFinished() {
// Comprueba si ha terminado (time-based)
void SmartSprite::checkFinished(float deltaTime) {
// Comprueba si ha llegado a su destino
on_destination_ = (getPosX() == dest_x_ && getPosY() == dest_y_);
if (on_destination_) {
if (finished_counter_ == 0) {
if (finished_delay_ms_ == 0.0f) {
finished_ = true;
} else {
--finished_counter_;
finished_timer_ += deltaTime;
if (finished_timer_ >= finished_delay_ms_) {
finished_ = true;
}
}
}
}