Actually add animsurf.
[koperkapel.git] / koperkapel / actors / orientatedsurf.py
index 6db857035c518ec8ed84e08c104a2dc8bb8dc976..ae79c43007d78a4ca28c19de52a352a53fd86655 100644 (file)
@@ -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,6 +23,9 @@ 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)