Mercurial > touhou
annotate pytouhou/game/orb.py @ 461:6af3854ed826
Make NativeText work with the fixed pipeline.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 11 Sep 2013 00:35:49 +0200 |
parents | b9d2db93972f |
children | 06f0eeb519bb |
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 | |
440
b9d2db93972f
Add a base Element class for every object in pytouhou.game.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
433
diff
changeset
|
16 from pytouhou.game.element import Element |
199 | 17 from pytouhou.game.sprite import Sprite |
18 from pytouhou.vm.anmrunner import ANMRunner | |
19 | |
20 | |
440
b9d2db93972f
Add a base Element class for every object in pytouhou.game.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
433
diff
changeset
|
21 class Orb(Element): |
b9d2db93972f
Add a base Element class for every object in pytouhou.game.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
433
diff
changeset
|
22 __slots__ = ('offset_x', 'offset_y', 'player_state', 'fire') |
200
300661f2ae8a
Fix orbs' original position
Thibaut Girka <thib@sitedethib.com>
parents:
199
diff
changeset
|
23 |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
24 def __init__(self, anm, index, player_state, fire_func): |
440
b9d2db93972f
Add a base Element class for every object in pytouhou.game.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
433
diff
changeset
|
25 Element.__init__(self) |
b9d2db93972f
Add a base Element class for every object in pytouhou.game.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
433
diff
changeset
|
26 |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
200
diff
changeset
|
27 self.sprite = Sprite() |
430
c9433188ffdb
Remove AnmWrapper, since ANMs are lists of entries now.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
28 self.anmrunner = ANMRunner(anm, index, self.sprite) |
199 | 29 |
30 self.offset_x = 0 | |
31 self.offset_y = 0 | |
32 | |
33 self.player_state = player_state | |
34 self.fire = fire_func | |
35 | |
36 | |
37 @property | |
38 def x(self): | |
39 return self.player_state.x + self.offset_x | |
40 | |
41 | |
42 @property | |
43 def y(self): | |
44 return self.player_state.y + self.offset_y | |
45 | |
46 | |
47 def update(self): | |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
200
diff
changeset
|
48 self.anmrunner.run_frame() |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
200
diff
changeset
|
49 |