changeset 26:f17122405121

Basic sprite animation support
author Thibaut Girka <thib@sitedethib.com>
date Fri, 12 Aug 2011 19:38:27 +0200
parents cc864aadc733
children b65d6bc55793
files pytouhou/game/background.py pytouhou/game/sprite.py
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/game/background.py
+++ b/pytouhou/game/background.py
@@ -15,6 +15,10 @@ class Background(object):
         self.object_instances = []
         self.objects_by_texture = {}
 
+        self.position_interpolator = Interpolator((0, 0, 0))
+        self.fog_interpolator = Interpolator((0, 0, 0, 0, 0))
+        self.position2_interpolator = Interpolator((0, 0, 0))
+
         self.build_objects()
         self.build_object_instances()
 
@@ -69,10 +73,6 @@ class Background(object):
             anm = self.anm_wrapper.anm_files[0]
             self.objects_by_texture = {(anm.first_name, anm.secondary_name): (nb_vertices, vertices, uvs)}
 
-            self.position_interpolator = Interpolator((0, 0, 0))
-            self.fog_interpolator = Interpolator((0, 0, 0, 0, 0))
-            self.position2_interpolator = Interpolator((0, 0, 0))
-
         for frame_num, message_type, args in self.stage.script:
             if frame_num == frame:
                 if message_type == 0:
--- a/pytouhou/game/sprite.py
+++ b/pytouhou/game/sprite.py
@@ -96,6 +96,9 @@ class Sprite(object):
             if 2 in properties:
                 self.rescale = unpack('<ff', properties[2])
                 del properties[2]
+            if 5 in properties:
+                self.frame, = unpack('<I', properties[5])
+                del properties[5]
             if 7 in properties:
                 self.mirrored = True #TODO
                 del properties[7]