summaryrefslogtreecommitdiff
path: root/render/draws/objects.lua
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-02-28 10:48:00 +0800
committerEltrac <hi@guhub.cn>2025-02-28 10:48:00 +0800
commit27d9e2acd1a70993480d1d175ff67b25504e9332 (patch)
tree848313d8c05861c2a853a9982158027241d15768 /render/draws/objects.lua
parent6f69e2598c9592a5adccf088d7088dfb4e5cd816 (diff)
fix: player moving animation
Diffstat (limited to 'render/draws/objects.lua')
-rw-r--r--render/draws/objects.lua13
1 files changed, 5 insertions, 8 deletions
diff --git a/render/draws/objects.lua b/render/draws/objects.lua
index caf04d9..47a7aa1 100644
--- a/render/draws/objects.lua
+++ b/render/draws/objects.lua
@@ -7,20 +7,17 @@ function draws.player()
love.graphics.setColor(1,1,1)
end
+ local cf = G.player.frameTimer.currentFrame
local facing = { [Direction.UP] = 4, [Direction.DOWN] = 1, [Direction.LEFT] = 10, [Direction.RIGHT] = 7 }
- local moving = { [Direction.UP] = { 5,6 }, [Direction.DOWN] = { 1,2 }, [Direction.LEFT] = { 9,10 }, [Direction.RIGHT] = { 11,12 } }
+ local moving = { [Direction.UP] = { 5,6 }, [Direction.DOWN] = { 2,3 }, [Direction.LEFT] = { 11,12 }, [Direction.RIGHT] = { 8,9 } }
local index = facing[G.player.facing]
- local movingFrame = 1
if G.player.moving then
- movingFrame = (movingFrame == 1) and 2 or 1
- index = moving[G.player.facing][movingFrame]
- else
- index = facing[G.player.facing]
+ print(cf)
+ index = moving[G.player.facing][cf]
end
- local x, y = G.player.x, G.player.y
- G.player.body:drawQuad("apple", index, x, y)
+ G.player.body:drawQuad("apple", index, G.player.x, G.player.y)
utils.resetGraphics()
end