Creating a dash attack for an enemy

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Rukasu

I’ve created a simple 2d enemy that can walk and turn at walls and avoid falls. It can detect when the player enters its field of view, but I don’t know any good ways to make him stop, dash, stop and dash again at the same distance and timing.
I’m currently using move-and-slide to move it and just scaling up the speed to create the dash, is there any other way?
I’m using timers to time the period between dashes and the small stop, but they don’t work the way it should work.
I couldn’t find any tutorial at this simple question.

For anyone that helps me, Thank You.