Mercurial > games > semicongine
changeset 807:5a301dbdfbc1
fix: animation time can overflow, clip it now
author | Sam <sam@basx.dev> |
---|---|
date | Mon, 11 Sep 2023 23:15:25 +0700 |
parents | 4ba8e610b9e8 |
children | 12f7f8a4f726 |
files | src/semicongine/animation.nim |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/semicongine/animation.nim Mon Sep 11 21:58:01 2023 +0700 +++ b/src/semicongine/animation.nim Mon Sep 11 23:15:25 2023 +0700 @@ -152,4 +152,4 @@ player.currentDirection = -player.currentDirection player.currentTime += float32(player.currentDirection) * dt * 2'f32 - player.currentValue = valueAt(player.animation, abs(player.currentTime) / player.animation.duration) + player.currentValue = valueAt(player.animation, (abs(player.currentTime) / player.animation.duration) mod high(AnimationTime))