Mercurial > touhou
comparison pytouhou/game/sprite.py @ 97:ac2e5e1c2c3c
Refactor \o/
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sun, 04 Sep 2011 23:50:00 +0200 |
parents | ca571697ec83 |
children | 2a03940deea3 |
comparison
equal
deleted
inserted
replaced
96:54929d495654 | 97:ac2e5e1c2c3c |
---|---|
14 | 14 |
15 from math import pi | 15 from math import pi |
16 | 16 |
17 from pytouhou.utils.matrix import Matrix | 17 from pytouhou.utils.matrix import Matrix |
18 from pytouhou.utils.interpolator import Interpolator | 18 from pytouhou.utils.interpolator import Interpolator |
19 | |
20 | |
21 class AnmWrapper(object): | |
22 def __init__(self, anm_files): | |
23 self.anm_files = list(anm_files) | |
24 | |
25 | |
26 def get_sprite(self, sprite_index): | |
27 for anm in self.anm_files: | |
28 if sprite_index in anm.sprites: | |
29 return anm, anm.sprites[sprite_index] | |
30 raise IndexError | |
31 | |
32 | |
33 def get_script(self, script_index): | |
34 for anm in self.anm_files: | |
35 if script_index in anm.scripts: | |
36 return anm, anm.scripts[script_index] | |
37 raise IndexError | |
38 | |
39 | 19 |
40 | 20 |
41 class Sprite(object): | 21 class Sprite(object): |
42 def __init__(self): | 22 def __init__(self): |
43 self.anm = None | 23 self.anm = None |