[Solved] Mind the Trap help needed please

while True:
    flag = hero.findFlag()
    enemy = hero.findNearestEnemy()
    inRange = hero.distanceTo(enemy) < 10
    if flag:
        # Pick up the flag.
        hero.pickUpFlag(flag)
        hero.say("I should pick up the flag.")
    elif enemy and inRange:
        hero.attack(enemy)

I’m just looking for one little hint on why i can’t seem to get past this level. I’ve tried all sorts of variations for the last hour or so and i’m stumped. Any help appreciated! Thanks.

Could you please post the link please

your code works you just need better equipment probably.

Thanks for your reply Eric!
I’m not sure what link you’re asking for though?
I’ll go back now and try upgrading my equipment first. Hope that makes it run!

I think Eric wants the link to the level.

As Eric said, you might be dying because you have weak armour. But it could also be about what you’re doing when you submit the level. The flags work for me, and the hero goes off and attacks the ogres when you put the flag near them. I was just wondering if you had done that yet.
Danny

Thanks guys, i’ve beaten this level now. I bought a load of strong armour and that seemed to fix it. It’s taken me some getting used to that i’m not supposed to just program the perfect strategy, then sit back and watch it run. I think i’d prefer that personally but it’s all good fun regardless!
Thanks again. Chris

1 Like

Congratulations on completing the level!

1 Like

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