annotate pytouhou/resource/anmwrapper.py @ 100:5c40cc1b8019

Use game's frame for interpolation. No more time manipulation interfering with interpolators!
author Thibaut Girka <thib@sitedethib.com>
date Mon, 05 Sep 2011 00:29:31 +0200
parents ac2e5e1c2c3c
children dbb1a86c0235
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
97
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
1 class AnmWrapper(object):
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
2 def __init__(self, anm_files):
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
3 self.anm_files = list(anm_files)
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
4
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
5
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
6 def get_sprite(self, sprite_index):
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
7 for anm in self.anm_files:
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
8 if sprite_index in anm.sprites:
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
9 return anm, anm.sprites[sprite_index]
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
10 raise IndexError
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
11
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
12
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
13 def get_script(self, script_index):
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
14 for anm in self.anm_files:
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
15 if script_index in anm.scripts:
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
16 return anm, anm.scripts[script_index]
ac2e5e1c2c3c Refactor \o/
Thibaut Girka <thib@sitedethib.com>
parents:
diff changeset
17 raise IndexError