Mercurial > touhou
comparison pytouhou/game/background.py @ 26:f17122405121
Basic sprite animation support
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Fri, 12 Aug 2011 19:38:27 +0200 |
parents | bf225780973f |
children | afa91be769ae |
comparison
equal
deleted
inserted
replaced
25:cc864aadc733 | 26:f17122405121 |
---|---|
12 self.stage = stage | 12 self.stage = stage |
13 self.anm_wrapper = anm_wrapper | 13 self.anm_wrapper = anm_wrapper |
14 self.objects = [] | 14 self.objects = [] |
15 self.object_instances = [] | 15 self.object_instances = [] |
16 self.objects_by_texture = {} | 16 self.objects_by_texture = {} |
17 | |
18 self.position_interpolator = Interpolator((0, 0, 0)) | |
19 self.fog_interpolator = Interpolator((0, 0, 0, 0, 0)) | |
20 self.position2_interpolator = Interpolator((0, 0, 0)) | |
17 | 21 |
18 self.build_objects() | 22 self.build_objects() |
19 self.build_object_instances() | 23 self.build_object_instances() |
20 | 24 |
21 | 25 |
67 uvs = struct.pack(uvs_format, *chain(*uvs)) | 71 uvs = struct.pack(uvs_format, *chain(*uvs)) |
68 assert len(self.anm_wrapper.anm_files) == 1 #TODO | 72 assert len(self.anm_wrapper.anm_files) == 1 #TODO |
69 anm = self.anm_wrapper.anm_files[0] | 73 anm = self.anm_wrapper.anm_files[0] |
70 self.objects_by_texture = {(anm.first_name, anm.secondary_name): (nb_vertices, vertices, uvs)} | 74 self.objects_by_texture = {(anm.first_name, anm.secondary_name): (nb_vertices, vertices, uvs)} |
71 | 75 |
72 self.position_interpolator = Interpolator((0, 0, 0)) | |
73 self.fog_interpolator = Interpolator((0, 0, 0, 0, 0)) | |
74 self.position2_interpolator = Interpolator((0, 0, 0)) | |
75 | |
76 for frame_num, message_type, args in self.stage.script: | 76 for frame_num, message_type, args in self.stage.script: |
77 if frame_num == frame: | 77 if frame_num == frame: |
78 if message_type == 0: | 78 if message_type == 0: |
79 self.position_interpolator.set_interpolation_start(frame_num, args) | 79 self.position_interpolator.set_interpolation_start(frame_num, args) |
80 elif message_type == 1: | 80 elif message_type == 1: |