Problems with Passing Through Backwoods

Hello,

please help me.
I hope this is posted in the right category.
I can´t find the Problem in the Code.
I use Python.
I checked it in this forum (but the coding language was a different one)
I always eat the first Mushroom when following my pet.

Don’t insult this tribe of peaceful ogres.

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, pet.pos.y)
# Else:
else:
# Move to the gem’s position.)
hero.moveXY(item.pos.x, item.pos.y)

Thank you!

Your Code is OK, it must be a bug …

it might be a bug but it might also be that you didn’t define your pet so the program didn’t got null when your wrote

pet.pos.x and pet.pos.y

I restarted and the position of gems and mushrooms changed, now I collect the first three gems and then the pet only surrounds me and I follow my pet in circles. No action to leave the area.
Man, no Idea.

I solved it,
I cheated :wink:
Thank you nevertheless!

Hey, I recently broke this level.

I apologize! It should be fixed now.

I recommend going back and un-cheating so you know the concepts.

Try again, not fixed. Hero moves to every item ignoring the !=.

MunkeyShynes told me that there is no and in between of pet.pos.x and pet.pos.y. I tried it and it said that something was wrong.