Unclear movement of go.animate position [SOLVED]

Good afternoon, I was able to implement the gui, but on trying to bring life to the sprites I ran into a misunderstanding of how go.animate works.

Special thanks to Potota and britzl for pointing me to this function.

(it’s needed to repel the enemy)

go.animate(".", "position.x", go.PLAYBACK_ONCE_FORWARD, pos.x + 100, go.EASING_LINEAR, 1)

But I ran into some problems:

pos.x + 100

works less efficiently than

pos.x - 100

Normal:


-100:

+100:

In general, at first I thought that there was a conflict with the update function, because update had to make pos.x = pos.x + 1 every frame, but disabling this function did not change the effect.

I’d like to note that there is a separate guide for the knockback function, but I want to understand what exactly is wrong with how this function works. It would seem that the effect should be the same.

Oh wait, I myself have a theory related to the error in main.

This is my first time answering someone’s question on the forum (unfortunately mine): I had a mistake in the position declaration, I should have declared it via self instead of local.

1 Like