Help on Keeping Time [SOLVED]

help guyz

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

Please post your code than just saying “I need help”.

1 Like

Also, why are you saying the tutorial? You need to post your code and format it.

1 Like

Yea, we need 2 c ur code inorder to help u with it.

3 Likes
# Use your new skill to choose what to do: hero.time

while True:
    # If it's the first 10 seconds, attack.
    if hero.time < 10:
        enemy= hero.findNearestEnemy()
        hero.attack(enemy)
        pass
    # Else, if it's the first 35 seconds, collect coins.
    elif hero.time < 35:
        items = hero.findItems()
        
        if items:
            hero.moveXY(items.pos.x, items.pos.y)
    # After 35 seconds, attack again!
    elif hero.time>35: 
        hero.attack(enemy)
    else:
        hero.moveXY(item.pos.x, item.pos.y)
        pass

Small error.

It should be this instead of what is above.

item = hero.findNearestItem()

if item:
    hero.moveXY(item.pos.x, item.pos.y)
    pass

Just a minor error.

what @milton.jinich said shoudl work

Thank You milton.jinich

Blockquote

Hope I am allowed to do this (Title editing). Sorry for break-in.

Ur good, @Anonym :slight_smile:

1 Like

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