Is there anybody knows the meaning of pos.
It pops out into the game automatically.
Second, can someone please have a look at my codes.
I am sure what’s wrong with them.
So the thing is, if item doesn’t exist, it’s null, it can’t get its position, so you can make it:
if item:
hero.moveXY(item.pos.x, item.pos.y)
i believe you were trying to make a function called checkToRun but it wouldn’t work the way you are doing it, what you can do if you have fixed what i told you up, you can add the else statement under it to move to 40, 13 and then you can erase the checkToRun function and directly use takeItem
You need to define checkTakeRun()
with the parameter item
like this:
def checkTakeRun(item): # Store 'item' as a parameter
if item:
takeItem(item)
else:
# hero.moveXY()