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

I need help still

Continuing the discussion from [SOLVED] Usual day:

yes it is and to the coins???

Can you please post your code.

1 Like

define item doing this item = hero.findNearestItem()

1 Like

First, you need to put all of that code in a while true loop. Then you find the nearest item, and if there is an item, move to the item with hero.moveXY(item.pos.x, item.pos.y).

1 Like

Can you just rewrite your code.

1 Like

i can do that…so i will do that

This pretty much says it.

while True:
    #find the nearest item
    # if the item exists
    #move to it.
1 Like

what is the code for that abc


bty i can not rpaly for 4 hours

by the way join my clan

And he has to kill munchkins.

2 Likes

Okay, so now you need to find the nearest item with item = hero.findNearestItem(). Then have in if loop checking if there is an item and its type is equal to “coin”. Inside of that if loop, moveXY to its position.

2 Likes

I said that here and for the coins do this if item.type == "coin":

1 Like

I think you have to write if item and item.type == "coin"

1 Like

Yes that is the solution

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