Go.animate Callback Function Not Executing

Hello, appreciate you taking a look–

I’m trying to make a dot move, and then do something once its done.

Using an anonymous function was recommended in this topic, and I think I’m matching the syntax unless I’ve gone crosseyed from looking at this too long.


function init(self)
	local dotPos = go.get_position("RedDot")
	go.animate("RedDot","position.x",gui.PLAYBACK_ONCE_FORWARD, dotPos.x - 100, gui.EASING_LINEAR, .8, 0, function() print("Implement ReanimateX") end)
	go.animate("RedDot","position.y",gui.PLAYBACK_ONCE_FORWARD, dotPos.y - 30, gui.EASING_LINEAR, 1.6, 0, function() print("Implement ReanimateY") end)
end

The init function is called, but no animation or print from the animation finishing seems to occur. I’m very new to lua, so I feel like I might be missing something basic. Please let me know if you have any thoughts. Thanks!

if this is for GUI script then you should use gui.animate not go.animate.

if this is for GO script then you should use go.PLAYBACK_ and go.EASING_

4 Likes

That is terribly obvious now that I’m thinking with all three brain cells, thank you!

This worked swimmingly
DotsRight

7 Likes