Problems with Passing Through Backwoods


#1

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!


#3


#4

Your Code is OK, it must be a bug …


#5

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

#6

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.


#7

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


#8

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.


#9

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


#10

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.