Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] I need help with bank raid

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

I did what the instructions told me to do and I just can’t see to have any luck doing the level

oh and the while True Loop didn’t make the paste

Can you include all your code?
Lydia

I edited it this is the code that doesn’t work for some weird reason

replace
coin = coins[coinIndex]
with
item = hero.findNearest Item()

the hint section said otherwise @qwerty

Your code seems fine to me, check that you have indented the places that you need to indent.
Lydia

like where @Lydia_Song you only have to add to lines of code and both are right

For example:
The right code:

while True:
    friends = hero.findFriends()

It has indents when you paste it into the CodeCombat level.
The wrong code:

while True:
      friends = hero.findFriends()

When you paste it into the CodeCombat level, it has no indents.
When you know there is an indent, you should see a blue block on the left of it.
Lydia

1 Like

Do you still need help or have you solved it?
Lydia

here is a screen shot of what is happening

I can’t find any indents in my code look at the screenshot

It worked when I tried it.

Your code looks indentical to mine, try resubmitting.
Lydia

I submitted it but it still didn’t work

Maybe you should try a different hero, or with different boots.

what is your problem

Do you have thornprick equipped?

this my equipment

Try using the boots of leaping instead. Also, maybe instead of a moveXY, you can use a move statement with the boots of leaping.