After my hero is done collecting coins at first, it defeats its second enemies, it stops. Here is my code:
while True:
enemies = hero.findEnemies()
# enemyIndex is used to iterate the enemies array.
enemyIndex = 0
# While enemyIndex is less than len(enemies)
while enemyIndex < len(enemies):
# Attack the enemy at enemyIndex
enemy = enemies[enemyIndex]
hero.attack(enemy)
# Increase enemyIndex by one.
enemyIndex += 1
coins = hero.findItems()
# coinIndex is used to iterate the coins array.
coinIndex = 0
while coinIndex < len(coins):
# Get a coin from the coins array using coinIndex
coin = coinIndex
# Collect that coin.
item = hero.findNearestItem()
hero.moveXY(item.pos.x, item.pos.y)
# Increase coinIndex by one.
coinIndex += 1
A few details to clean up, although this didn’t directly impact the problem. What hero and gear do you have? I found that the Ring of Thorns can cause some problems on this level.
To use the index for the array it should be: variable = array[index]
while coinIndex < len(coins):
# Get a coin from the coins array using coinIndex
coin = coinIndex # look at how it was done with enemy
Then use that variable for the move command instead of creating a new variable.
First do what Brooksy said, but even then it still doesn’t work sometimes and the hero just says “But it’s dead!”. To solve this simply put: if enemy.health > 0: before you attack the enemy to make sure it’s still alive.
-Danny
Can someone buff the level 66 items please? The Crypt Key costs 3100 gems and only have the power of the precious. The boots of flying costs about 500 moregems than boots of leaping and only increases speed by 0.5m/s, the Amber sense stone sux and I have to buy it to play this level I think. The hammers are only the strength of the stone hammer.
while True:
enemies = hero.findEnemies()
# enemyIndex is used to iterate the enemies array.
enemyIndex = 0
# While enemyIndex is less than len(enemies)
while enemyIndex < len(enemies):
# Attack the enemy at enemyIndex
enemy = enemies[enemyIndex]
hero.attack(enemy)
# Increase enemyIndex by one.
enemyIndex += 1
coins = hero.findItems()
# coinIndex is used to iterate the coins array.
coinIndex = 0
while coinIndex < len(coins):
# Get a coin from the coins array using coinIndex
coin = coins[coinIndex]
# Collect that coin.
hero.moveXY(coin.pos.x, coin.pos.y)
# Increase coinIndex by one.
coinindex += 1
my hero can’t collect coins after it collects the first one!
oh might be a glitch cause it says im required to use them.
OMG the morning’s edge only have 80 dps, it should be unlocked at level 15. nvm i will get sword of the forgotten instead, teample guard way too expenise
@nick can you reset my gems please? my username is ProGamer247, if the reset deletes the heros i got when im a subscriber, then dont reset cuz i got okar and omarn