revisat background, game_logo, smart sprite, tiled_bg
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user