Mercurial > games > semicongine
changeset 346:da0375455adb
fix: animation time can overflow, clip it now
author | Sam <sam@basx.dev> |
---|---|
date | Mon, 11 Sep 2023 23:15:25 +0700 |
parents | 1c40de824c39 |
children | 5c22302f1485 |
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))