Why is my boss randomly reverting to the second phase?

I am making a boss fight game where the boss goes through multiple phases depending on its health. But when it reaches phase 3, It will use its new attack for a while, then revert back to phase 2. Why is it doing this? PLEASE HELP!!!

Game: https://makecode.com/_JLX369V7rAk7

Neat game! Here’s what I think is happening.

You have this event handler, which kicks in when the boss’s HP reaches 50%:

image

But then, you also have this running every 10 seconds:

image

So, if the boss is the in middle of attacking and then moving home while it’s switched to phase 3, then once the boss returns home, it switches back to phase 2.

One way to fix this is to reset the phase only if the boss is still in phase 0. If the boss has transitioned to another phase, then don’t change it.

image

You’d need to add this if block in three different places in that on game update every 10000 ms container.

If you’re still stuck, then just let us know!

1 Like

Thank you so much! This helped alot!

1 Like