I don’t think this is how it should be done.
I’m going to assume that the everything but the loop
s should be intended.
This code is not correct (it is not wrong, but also not correct) because:
- Your second
loop
will never be executed, because the first one never stops running.
- You should only cleave when they are closer than 10 units.
- You should not cleave unless the enemies are closer than 10 units.
Programming Style tip:
- You should check if
this.sReady("cleave")
before cleaving.
I assume you just got the timing right with all your attacks, and it might even work, but if your enemies close in too late, you don’t catch anyone with your cleave, and if they close in too early you get damage up to a point where you die unless you have a lot of HP.