Mercurial > touhou
annotate pytouhou/game/orb.py @ 330:16ed1ab1e14b
Add a GameRunner.load_game method to allow level changes.
This will probably get changed later, but this is sufficient to change levels
for a story mode or a boss rush mode, for instance.
* * *
Fix previous patch
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sat, 30 Jun 2012 13:02:24 +0200 |
parents | f3099ebf4f61 |
children | c9433188ffdb |
rev | line source |
---|---|
199 | 1 # -*- encoding: utf-8 -*- |
2 ## | |
3 ## Copyright (C) 2011 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | |
4 ## | |
5 ## This program is free software; you can redistribute it and/or modify | |
6 ## it under the terms of the GNU General Public License as published | |
7 ## by the Free Software Foundation; version 3 only. | |
8 ## | |
9 ## This program is distributed in the hope that it will be useful, | |
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 ## GNU General Public License for more details. | |
13 ## | |
14 | |
15 | |
16 from pytouhou.game.sprite import Sprite | |
17 from pytouhou.vm.anmrunner import ANMRunner | |
18 | |
19 | |
20 class Orb(object): | |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
200
diff
changeset
|
21 __slots__ = ('sprite', 'anmrunner', 'offset_x', 'offset_y', 'player_state', |
200
300661f2ae8a
Fix orbs' original position
Thibaut Girka <thib@sitedethib.com>
parents:
199
diff
changeset
|
22 'fire') |
300661f2ae8a
Fix orbs' original position
Thibaut Girka <thib@sitedethib.com>
parents:
199
diff
changeset
|
23 |
199 | 24 def __init__(self, anm_wrapper, index, player_state, fire_func): |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
200
diff
changeset
|
25 self.sprite = Sprite() |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
200
diff
changeset
|
26 self.anmrunner = ANMRunner(anm_wrapper, index, self.sprite) |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
200
diff
changeset
|
27 self.anmrunner.run_frame() |
199 | 28 |
29 self.offset_x = 0 | |
30 self.offset_y = 0 | |
31 | |
32 self.player_state = player_state | |
33 self.fire = fire_func | |
34 | |
35 | |
36 @property | |
37 def x(self): | |
38 return self.player_state.x + self.offset_x | |
39 | |
40 | |
41 @property | |
42 def y(self): | |
43 return self.player_state.y + self.offset_y | |
44 | |
45 | |
46 def update(self): | |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
200
diff
changeset
|
47 self.anmrunner.run_frame() |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
200
diff
changeset
|
48 |