[SOLVED]Bank Raid(python)

The hero doesn’t collect the coins. Please help.
code2

can you write down your code not take a picture of it

do I have to? I don’t see why it makes a difference.

um yeah it would be easier for me to check what you did wrong

# Wait for ogres, defeat them and collect gold.
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
    coin = hero.findItems()
    # coinIndex is used to iterate the coins array.
    coinIndex = 0
    while coinIndex < len(coin):
        # Get a coin from the coins array using coinIndex
        coin = coin[coinIndex]
        # Collect that coin.
        hero.move(coin.pos.x,coin.pos.y)
        # Increase coinIndex by one.
        coinIndex += 1

There, I copy and pasted it.

change the hero.move(coin.pos.x,coin.pos.y) to hero.moveXY(coin.pos.x,coin.pos.y)

That helped a lot . Thank you I should have known!

1 Like

no problem(20characters)

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.