[SOLVED]I need help on copper meadows

when you click submit you have to use the flags to move around
you have to manually put the flags in the area with the coins

i tryed it the hero wouldnt move

1 Like

take away the pass. 20

3 Likes

to the flag

1 Like

Delete the pass statement.

1 Like

ok i took it off

1 Like

Try what I said above when you click submit

still

take a screenshot of whats happening and put it here

That should be:

flag = hero.findFlag()
2 Likes

how do i do that i forgot

1 Like

try what @abc said first

thanks

1 Like

ok so I am gonna mark this topic as solved ok?

1 Like

ok

4 Likes

Hi I need help and here is my code.

# Collect all the coins in each meadow.
# Use flags to move between meadows.
# Press Submit when you are ready to place flags.

while True:
    flag = hero.findFlag()
    if flag:
        pass  # `pass` is a placeholder, it has no effect.
        # Pick up the flag.
        hero.pickUpFlag(flag)
    else:
        # Automatically move to the nearest item you see.
        item = hero.findNearestItem
        if item:
            position = item.pos
            x = position.x
            y = position.y
            hero.moveXY(x, y)

It said that X is undefined

Hi please make your own topic for this

umm @milton.jinich They can ask for help because its related to this topic.
dont tell them to make a new topic if their problem is related to the topic

1 Like

I think it’s undefined because you didn’t say who/what you want the position.x and position.y to be defined as.
For example:

x = item.position.x
y = item.position.y
hero.moveXY(x, y)

In this case, you want it to move to the closest item the hero sees, so how would you do that?

Sorry if it doesn’t make sense. :sweat_smile:

Rachel

Okay well he already made a topic for it. I found the problem

1 Like