if new_x < 0: new_x = self.width - 1 if new_y < 0: new_y = self.height - 1 if new_x >= self.width: new_x = 0 if new_y >= self.height: new_y = 0