X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=new%2Fplomrogue%2Fthings.py;fp=new%2Fplomrogue%2Fthings.py;h=5d1c7bce1b72bf21b7fdd23a64a67998236019aa;hb=d918b4815941beb84b34c985b5e99dcc8499d239;hp=2e97541a8cb2416eaa3ead7bad023c4b9d75ce3d;hpb=b7587718cee2308bd2a27462e0996dc279bd3038;p=plomrogue2-experiments diff --git a/new/plomrogue/things.py b/new/plomrogue/things.py index 2e97541..5d1c7bc 100644 --- a/new/plomrogue/things.py +++ b/new/plomrogue/things.py @@ -254,11 +254,10 @@ class ThingAnimate(Thing): def get_surroundings_offset(self): if self._surroundings_offset is not None: return self._surroundings_offset - offset = YX(self.position[0].y * self.game.map_size.y + - self.position[1].y - self._radius, - self.position[0].x * self.game.map_size.x + - self.position[1].x - self._radius) - self._surroundings_offset = offset + y_long = self.position[0].y * self.game.map_size.y + self.position[1].y + x_long = self.position[0].x * self.game.map_size.x + self.position[1].x + yx_to_origin = YX(y_long, x_long) + self._surroundings_offset = yx_to_origin - YX(self._radius, self._radius) return self._surroundings_offset def get_surrounding_map(self): @@ -267,9 +266,8 @@ class ThingAnimate(Thing): self._surrounding_map = Map(size=YX(self._radius*2+1, self._radius*2+1)) offset = self.get_surroundings_offset() for pos in self._surrounding_map: - offset_pos = pos + offset - absolutize = self.game.map_geometry.absolutize_coordinate - big_yx, small_yx = absolutize(self.game.map_size, (0,0), offset_pos) + correct = self.game.map_geometry.correct_double_coordinate + big_yx, small_yx = correct(self.game.map_size, (0,0), pos + offset) map_ = self.game.get_map(big_yx, False) if map_ is None: map_ = Map(size=self.game.map_size)