Bug BOOKKEEPER . I'm exhausted


#1

Fight enemies for 15 seconds.

Keep count whenever an enemy is defeated.

defeated = 0
while True:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
if enemy.health <= 0:
defeated += 1
if hero.now() > 15:
break

Tell Naria how many enemies you defeated.

hero.moveXY(59, 33)
hero.say(defeated)

Collect coins until the clock reaches 30 seconds.

totalGold = 0
while True:
coin = hero.findNearestItem()
if coin:
# Pick up the coin.
hero.moveXY(coin.pos.x, coin.pos.y)
totalGold += coin.value
pass
if hero.now() >30:
break
hero.moveXY(59, 33)
hero.say(totalGold)

Tell Naria how much gold you collected.

Fight enemies until the clock reaches 45 seconds.

Remember to reset the count of defeated enemies!

defeated1 = 0
while True:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
if enemy.health <= 0:
defeated1 += 1
if hero.now() > 15:
break

Tell Naria how many enemies you defeated.

hero.moveXY(59, 33)
hero.say(defeated1)


#2

totalGold += coin.value

coin.value doesnt work (((((((((


#3

Is there any more information you can give?

Just so you know, I will try to help you the best I can as I have not attempted this level yet.


#4

Also, please format your code according to the FAQ. It helps us better understand your code as we try to help you. If you have trouble finding it: click here:


#5

It’s not a bug. The problem is what you are calculating coins where you move. But your hero can take some additional coins whiles/he is moving. As the result you totalGold is less than the real amount. Try to use hero.gold to say how much gold you have.