[Solved] Is there a better way to do this looping enemy pattern?

Hello! I’ve made an enemy for the game I’m making and realized that it seems not optimized.

Here are the events:

In these events I make a variable that keeps switching. When it is false my enemy keeps jumping and then after its 3rd jump it turns the variable true, waits a bit, then turns it back to false to repeat the process.

There are other events, but they are just for movement and sound.

Now back to the question, is there a better way to do this, or is it as optimized as it is? :thinking:, I just thought because of all of those wait actions. I thought of this because I just completed the first world and was optimizing my other events :face_with_raised_eyebrow:.

I would consider using an object timer. Check the timer value and perform action based on what range the timer falls within.

Or you could use tweens. Sound silly, but they make good timers. Run it and once it’s finished run the next one. So you could name the tweens as “jump1”, “jump2” & “jump3” and “delay”. When each one has finished delete it, perform the action and start the next one.

Thanks! They both worked really well, the tween one seemed better in my opinion, so I am going to use that one. Thanks for helping me out! :smiley: