[SOLVED] Problems with "Passing Through"

My pet wolf isn’t moving at all, so my hero is just standing in place.

Here’s my code if you need it:

while True:
    item = hero.findNearestItem()
    if item:
        # If item.type IS NOT EQUAL TO "gem"
        if item.type != "gem":
            # Then follow your pet wolf.
            hero.moveXY(pet.pos.x and pet.pos.y)
        # Else:
            if item == ("gem"):
                hero.moveXY(item.pos.x, item.pos.y)

Here is an image of the level and what’s happening (if you guys need it.)


Remove this line line from the else statement:

if item == ("gem"):

It is unnecessary and incorrectly written. I’m no Python expert but from what I’ve seen, this is how you should code it properly:

if item.type == "gem":

Thank you very much!



No problem. Please change the title of this question to [SOLVED] Problems with “Passing Through” so people do not accidentally answer again.


Thing is, I tried this and it didn’t work. What should I do?
Also, when I put and in between “pet.pos.x and y”, it says “You need to put ` in.” What do I do?

If you post your code it would be a lot easier to see what the issue is. Why are you putting ‘and’ in between pet.pos.x, pet.pos.y? ‘And’ shouldn’t be there. There should just be a comma separating the two.

If you have questions about how to format a method, just click on the method in question in the middle portion of the screen. It will give you the proper format. When you click on the moveXY(x, y) method you can see that there is no ‘and’ in the parenthesis.

I didn’t know. I looked at the picture and saw the word "AND"
I wasnt sure what to do.

Didn’t work…but figured it out for anyone else who has trouble!(python)

Mod edit:

(Solution removed)

Please do not post solutions. Thanks.