[Solved] Existing momentum moves player after dialogue ends

Hello. I’m using the platformer behaviour for a character who talks to other characters. The behaviour is deactivated during dialogue and reactivated when dialogue ends. If the player character is standing still when he initiates dialogue, all is well. If he is moving (on the x axis; he has to be on the floor to talk) when he initiates dialogue, it’s like the momentum is paused and resumes again once dialogue has ended. In other words, the player character will briefly change to his walking animation and walk a step or two once dialogue is no longer running, without the player pressing left/right.

I have tried reducing his current horizontal speed to zero when dialogue starts. This helps by stopping him moving when dialogue ends, but you can still see his walk animation briefly flicker before his idle animation kicks in. I don’t seem to be able to cancel out the forces that were being applied to him when he initiated dialogue.

Is there a way to remove all forces affecting a platformer character while moving, like colliding with a wall does? Thank you.

Edit: Setting his acceleration to zero at the beginning of dialogue and then setting it back to his usual 1500 when dialogue ends does not help.

1 Like

I don’t think you can cancel current behavior forces when you deactivate it… a pity. Calls for a feature request?
If you only see the walk animation for one frame, you should be able to override it by applying the idle animation at that time (in an event lower than the animation event). An ugly workaround, yes.

Thanks Gruk. I think you’re right: there doesn’t seem to be a way to remove currently applied forces from a platform character. I tried finding an equivalent or similar action again today. Such a feature would be good, though, as part of the activate/deactivate platformer behaviour action. The original issue I described can also be seen when the player closes the inventory if he was walking when he opened it.

As you suggest, I will experiment with forcing the idle animation as a way of hiding the brief flash of walk animation.

Edit: Now when dialogue ends a variable becomes true, which is used to launch my ‘jitter fix’ event: I set the player character’s animation to idle, wait 0.1 seconds, then set the variable back to false. It hides the behaviour described above. Thanks Gruk.

1 Like