From 2086ea379583fdd433e7f9c5c980d82ae65cded7 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 5 Mar 2016 15:23:50 +0200 Subject: [PATCH] Hack anchor support for rotation --- koperkapel/actors/orientatedsurf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/koperkapel/actors/orientatedsurf.py b/koperkapel/actors/orientatedsurf.py index 6db8570..720bb20 100644 --- a/koperkapel/actors/orientatedsurf.py +++ b/koperkapel/actors/orientatedsurf.py @@ -4,6 +4,7 @@ from pygame.transform import rotate from pgzero.actor import POS_TOPLEFT, ANCHOR_CENTER from .surf import SurfActor +from ..constants import TILE_SIZE class OrientatedSurfActor(SurfActor): @@ -22,8 +23,12 @@ class OrientatedSurfActor(SurfActor): @angle.setter def angle(self, angle): + cur_anchor = self._anchor_value + if angle not in (self._angle, self._angle + 180, self._angle - 180): + self._anchor_value = (cur_anchor[1], cur_anchor[0]) self._angle = angle self._surf = self._orig_surf = rotate(self._base_surf, angle) + print(self.anchor, self.angle) @property def surf(self): -- 2.34.1