Hi! My hero isn’t attacking, yet I coded it to attack multiple times. Before, after it attacks, it would just stand there instead of moving torward the mushrooms and collecting them. Why is this happening, and can anyone tell me how to accomplish this level?
This is my code
while True:
if item == hero.findItems():
item = hero.findNearestItem()
if mushroom:
hero.findNearestItem()
items = self.findNearestItem()
if hero.findItems():
item = self.findItems()
self.findItems()
if enemy == hero.findNearestEnemy():
hero.findNearestEnemy()
hero.attack(enemy)
if enemy:
hero.attack(enemy)
hero.shield()
enemy = hero.findNearestEnemy()
hero.cleave(enemy)
if enemy:
hero.attack(enemy)
if enemy:
hero.findNearestEnemy()
else:
enemy = hero.findNearestEnemy()
hero.attack(enemy)
if item == hero.findItems():
item = hero.findNearestItem()
else:
hero.findNearestEnemy()
hero.attack(enemy)
if hero.findFlag(“green”):
hero.findFlag(“green”)
hero.pickUpFlag(flag)
hero.removeFlag(flag)
mushroom = hero.findItems()
items = self.findItems()
if mushroom:
hero.findNearestItem()
items = self.findNearestItem()
if hero.findItems():
item = self.findItems()
self.findItems()
Thank you,
IcyFire