# Use your new skill to choose what to do: hero.time while True: if hero.time < 10: if enemy: enemy = hero.findNearestEnemy hero.attack(enemy) pass elif hero.time < 35: if coin: coin = hero.findNearestItem() hero.moveXY(coin.pos.x, coin.pos.y) pass else: enemy = hero.findNearestEnemy() hero.attack(enemy) pass hero.summon("archer")
You need to switch the if enemy and hero.findNearestEnemy
You also need to switch the hero.findNearestItem and if coin.
You have to have your hero try to find something before you say what happpens if that something is there.
# Use your new skill to choose what to do: hero.time while True: hero.findNearestEnemy() if hero.time < 10: enemy = hero.findNearestEnemy() if enemy: hero.attack(enemy) pass elif hero.time < 35: hero.attack(enemy) hero.attack(enemy) hero.attack(enemy) pass
how does this look
what about collecting coins?
@Code_Kid13 i figured out i don’t have todo that because the archers are collecting coins
what archers? the crossbow man summons soldiers and archers when you collect coins in this level
there is the archer that i am talking about
could you send me your code please then @Code_Kid13
that is the crossbow man
then what is the solution
PLEASE i NEED SO MUCH HELP
I won’t give you a direct answer, but we can work through this together. You need all three parts to this because your hero isn’t probably strong enough to fight off all the enemies even with your friend archer Naria who just fights with you. You collect the coins to call more friends to fight with you (the level calls the friends for you if you have enough coins).
Because this is based on time, the first section won’t run after 10 seconds so you need to declare a new variable with each time frame.
Each section needs the same three steps:
- declare the variable and assign a value
- check “if” the variable exists
- command your hero
You may need to get better armor for more health if your code works but your hero keeps dying.
ok thank you so much
@brooksy125 Happy to see you!
Did you read Hints???