Author Topic: Path Movement behaving weirdly  (Read 26 times)

The Pink Bunny

  • Newbie
  • *
  • Posts: 15
  • Zelda is your...
    • View Profile
Path Movement behaving weirdly
« on: April 17, 2019, 12:41:39 am »
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?

llamazing

  • Full Member
  • ***
  • Posts: 183
    • View Profile
Re: Path Movement behaving weirdly
« Reply #1 on: April 17, 2019, 03:35:45 am »
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().