coin = hero.findNearestItem()
gives a bug in python
maybe change it to
coin = self.findNearestItem()
and
hero.moveXY(coin.pos.x, coin.pos.y)
should be
self.moveXY(coin.pos.x, coin.pos.y)
nvm it still works but it is a bit confusing to be using self and then have it switch to hero
We recently have switched all levels over from self
and this
to hero
. You can see a post in the forums about it here: You can now use hero instead of "self" or "this"!
We think this will help people understand what they’re writing, and fixes up a few oddities with the Javascript this
usage. Sorry for the confusion, but we believe this will be better for the future!
1 Like
Maby you use too good glasses on your hero. Last glasses have no method findNearestItem(). Instead this method you ca use coin = hero.findNearest(hero.findItems())