aboutsummaryrefslogtreecommitdiff
path: root/src/sprite.lua
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-03-30 17:50:02 -0400
committeriamcheeseman <[email protected]>2026-03-30 17:50:02 -0400
commit7859709ac3b1500e3037c5dceacb77bcff778e89 (patch)
treebfa0114912cd9467e6c78a1af8b8b32790ebe47b /src/sprite.lua
parent11bf6c1c702664aeb2e1e09168915d2564a0656d (diff)
Read frame durations from aseprite files
Diffstat (limited to 'src/sprite.lua')
-rw-r--r--src/sprite.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/sprite.lua b/src/sprite.lua
index b790a9e..0048b9f 100644
--- a/src/sprite.lua
+++ b/src/sprite.lua
@@ -47,11 +47,12 @@ end)
function sprite_anim_sys(ent, dt)
local sprite = ent.sprite
local tag = sprite.anim.tags[sprite.active_tag]
+ local frame_duration = sprite.anim.frame_durations[sprite.frame]
sprite.timer = sprite.timer + dt
- if sprite.timer > tag.duration then
+ if sprite.timer > frame_duration then
sprite.frame = sprite.frame + 1
- sprite.timer = 0
+ sprite.timer = sprite.timer - frame_duration
end
if sprite.frame >= tag.to then