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

Bug in Double Cheek


In the level Double Cheek, I set a position, but it said it was an error. Can you help me?



You must define targetPos. Try using coin.pos. That should work.


It looks like that’s what he did.


Try defining coin using a different method, like hero.findNearestItem. Currently, you are using hero.findItems, which finds an array of items but doesn’t define a particular position of each item or which one to move to. With findNearestItem, you are defining a single position of a single item to move to - the nearest coin. Also, the moveXY method would be better to use here. With the “move” method, the hero takes a single step toward the target position and then iterates through the code again to see if there’s something else it should or could be doing. With the moveXY method, the hero just moves to the item’s position without doing anything else until it gets there. And then it looks for the next nearest item.



Thank you for your help! I took both of your suggestions and I completed the level!


coin is a array & you need to use coin[0];