revisat moving i animated sprite

This commit is contained in:
2025-09-23 08:29:29 +02:00
parent 8f83a1d13e
commit 1a6ef79466
5 changed files with 19 additions and 21 deletions

View File

@@ -81,16 +81,13 @@ void MovingSprite::render() {
// Establece la rotacion (time-based)
void MovingSprite::rotate(float deltaTime) {
if (rotate_.enabled) {
// DeltaTime puro: velocidad de rotación debe estar en unidades/ms
float rotationFrameTime = static_cast<float>(rotate_.speed) * (1000.0f / 60.0f);
rotate_.angle += rotate_.amount * (deltaTime / rotationFrameTime);
rotate_.angle += rotate_.amount * deltaTime;
}
}
// Activa o desactiva el efecto de rotación
void MovingSprite::setRotate(bool enable) {
rotate_.enabled = enable;
rotate_.counter = 0;
}
// Establece la posición y_ el tamaño del objeto