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

Keeping time PLZ HELP ME

@Code_Kid13 @dedreous @Chaboi_3000 @Deadpool198 @ducky @MunkeyShynes

# 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.

@Code_Kid13

# 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

image
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

A Fun Level To Try Out! >
Keeping time PLZ HELP ME

@brooksy125
can you please help me out or have the code pasted so i can move on because i have been stuck on this level for days @dedreous @Chaboi_3000 @duckyducky @PythonCoding
thank you Zax

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:

  1. declare the variable and assign a value
  2. check “if” the variable exists
  3. command your hero

You may need to get better armor for more health if your code works but your hero keeps dying.

1 Like

ok thank you so much

@brooksy125 Happy to see you!

1 Like

Did you read Hints???

yes

[en_US.composer.my_button_text]