I want to change animation each time mouse over node, but the problem when i move pointer, the code always start animation, not wait until finish then loop.
Here my code,
function on_input(self, action_id, action)
if gui.pick_node(n, action.x, action.y) then
gui.play_flipbook(n, "slide")
else
gui.play_flipbook(n, "idle")
end
end
gui.play_flipbook() has a complete_function as a third parameter. I would set a flag to indicate that the animation is playing and clear the flag in the complete_function. While the flag is set no new animations should be started.
After amount of time and effort, i change code like this :
function tes()
playanim2 = false
playanim1 = false
end
if gui.pick_node(n, action.x, action.y) then
if (playanim2) then
gui.play_flipbook(n, "slide", tes())
end
playanim1 = true
else
if (playanim1) then
gui.play_flipbook(n, "idle", tes())
end
playanim2 = true
end
Thank you guys, i am using callback like you said, it work fine. You are best.