Hi, I am starting The Trials, and I am stuck at the end of the first Oasis. I kill all the enemies, eat all the mushrooms and defeat the onslaught including an enormous ogre. My problem is figuring how to wait for the final attacks. I set up a loop to watch for enemies and invoke an array if enemies appear, but I don’t know how to break the loop when the enemies stop appearing.
#attack Enemies is obviously an infinite if I can’t figure out how to break it.
I know that I can use flags to solve this problem, but I was hoping for a logic based solution.
Thanks for your help.
#Gather mushrooms
shrooms = self.findItems()
itemIndex = 0
while itemIndex < len(shrooms):
nShroom = shrooms[itemIndex]
self.moveXY(nShroom.pos.x, nShroom.pos.y)
itemIndex += 1
#attack Enemies
loop:
enemies = self.findEnemies()
enemyIndex = 0
while enemyIndex < len(enemies):
enemy = enemies[enemyIndex]
while enemy.health > 0:
self.attack(enemy)
enemyIndex +=1