We rewrite simple infinite loops that just use
while True: to insert a one-frame yield if you don’t take any blocking action. So this:
if <no time has passed since the start of the loop>:
We don’t do this when the
while condition is something more complicated, because maybe you want to loop over an array or something. So time doesn’t pass inside those loops; you’d have to add the
hero.wait(0.01) call yourself.
wait is available on some of the wristwatches.
In Mages’ Might, though, you just don’t have that API, so you’d have to rewrite your
while True: loop like this so that you can take advantage of automatic simple loop yielding:
missile = hero.findNearest(hero.findFriendlyMissiles())
if hero.color == "red" and missile.pos.x > 50:
elif hero.color == "blue" and missile.pos.x < 50:
print("End of loop")