- 編集済み
Switching animations within LOVE2D???
Within love.update I have this movement code.
I have notated where I wish to put new code.
(the start animation is 'standing'.)
---
movement for player
if love.keyboard.isDown('a') then
dx = -vx*delta
---
Here I want to: Change animation to 'Run' and flip the skeleton to face right?
elseif love.keyboard.isDown('d') then
dx = vx*delta
---
Here I want to: Change animation to 'Run' and flip the skeleton to face left?
else
dx = 0
---
Here I want to: Change the animation back to the standing animation.
end
Can someone help please?
Implement an attachment that has the second skeleton and make your skeleton renderer know how to render that attachment. The second skeleton uses the draw order of the slot it is in.
Thank you for replying.
Could you please expand on this? I'm struggling to get it.
Perhaps some example code?
// set animation
state:setAnimationByName(0, "run")
// flip
skeleton.flipX = true
skeleton.flipY = false
You'll want to only set the animation when the key goes down, not every frame it is pressed.