Path Movement behaving weirdly

Started by The Pink Bunny, April 17, 2019, 12:41:39 AM

Previous topic - Next topic
I have a soldier enemy which does a path movement and a target movement. For some reason, any time the path movement is stopped (when the target movement happens, or when I stop it manually), it seems to still be happening in the background. Once whatever movement or animation controlling the entity is finished, the entity rapidly follows all of the path movements that would have happened during that time.

I have been trying to debug this for hours, and I am absolutely stumped why this is happening, or how to stop it. Can anyone help?

I am not able to reproduce the problem you describe. Once the enemy starts its looking animation it doesn't seem to do anything else after. If I manually stop the movement during the path movement, then the enemy halts and the walking animation continues to be active.

Looking at the code, it seems that the only place the movement is started is in the on_restarted event(). My best guess would be that on_restarted() is getting called when you don't expect it to be. You could try adding a print statement in that event and see if it is getting triggered unexpectedly.

The other problem that is immediately obvious to me is that the look_around() function in the spotted==false condition can set chasing=false, set the path movement, then restart the enemy. But restarting the enemy will set a new path if chasing==false, so I don't think there's any point to setting the path in look_around().

If you can't reproduce the issue, could it be a hardware issue? A problem caused by the map? I've tried it on several different maps, and the same thing happens for me every time. I've tried putting print statements in pretty much every place I can think of, and on_restarted() isn't getting called unexpectedly anywhere.

The behavior you described sounds like an issue I was having with this enemy a long time ago, but this code has been changed a bunch since then.

As for your other comment, you're right, that line in look_around() was supposed to set the sprite direction, not the path.