Hello all,
I hope that you all are well! I have run into some issues while animating my character’s movement. As of right now, the code is:
if action_id == hash("left") then
facingleft = true
facingright = false
if action.pressed and facingleft and onground then
msg.post("#sprite", "play_animation", { id = hash("run") })
end
if action.released and onground then
msg.post("#sprite", "play_animation", { id = hash("idle") })
end
end
if action_id == hash("jump") then
jumping = true
onground = false
if action.pressed then
msg.post("#sprite", "play_animation", { id = hash("jumping") })
end
end
The problem with this is, if the player presses jump and left/right at the same time, and lands without releasing left/right, then the character gets stuck in the idle animation. This is, until left/right is released, and clicked again.
Any insight would be greatly appreciated!
If I poorly explained this, please let me know!
Best,
V