Here’s a simplified version of some code that doesn’t work well for me. This is on level 1, but I presume would have the same basic problem on other levels. Essentially what happens is that after I teleport, the hero thinks the nearest item is from pre-teleport location rather than post-teleport location.
But I have the item finding at the top of the loop and the move to the teleport location at the bottom of the loop. So shouldn’t the hero recalculate the nearest item AFTER teleporting? Or is something wrong with my logic? (probably!)
loop: item = self.findNearest(self.findItems()) if item: self.moveXY(item.pos.x,item.pos.y) if self.pos.x > 40: if self.pos.y > 40: x = 76 y = 51 else: x = 76 y = 19 else: if self.pos.y > 40: x = 5 y = 49 else: x = 5 y = 19 self.moveXY(x,y)