Platformer. The enemy's Dash attack does not work correctly

Hello, colleagues! I want to make an enemy dash attack. He has to run through the player. As an example, the ShieldBearer from the game Dead Cells.
I did it using variables. If the variable “Dash” = “Right” or “Left”, then it runs in a certain direction. If the variable “Dash” = “None”, then it does not run.
The first time it works as it should. But then the enemy starts running towards the player, spinning around the player, even though he has the variable “Dash” = “None”! I don’t understand what the problem is. :worried:
I hope for your help, colleagues!

Could you upload a screen recording of its behavior? I have an idea as to what is going on, but I need to see it to verify.


maybe try deleting the first unpause(1.0), and by the 2nd circle (2.0), instead of resetting it and pausing it, just go ahead and delete it, the code might work as intended

Did you try this extension?

imnotdream, it doesn’t work((( The problem is the same

davy, how do I make the enemy use dash in the right direction? Flip doesn’t help

Sorry, I was guessing cuz it looked a little weird to me

It might be dashing again constantly on both sides, maybe make it disable after a dash for a while, but I’m not sure

I hope this helps

1 Like

Thank you, colleague, for the example! I studied your code, found useful things for myself.
You shouldn’t have deleted the previous comment))) He was also very helpful to me) I remembered that there was something about timers.
And thanks to all the colleagues who tried to help!

1 Like

I deleted the previous message because the were flaws in the logic I suggested there.

1 Like