comparison pytouhou/game/orb.py @ 199:8ec34c56fed0

Implement orbs.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 31 Oct 2011 09:38:57 -0700
parents
children 300661f2ae8a
comparison
equal deleted inserted replaced
198:13918723d1bc 199:8ec34c56fed0
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):
21 def __init__(self, anm_wrapper, index, player_state, fire_func):
22 self._sprite = Sprite()
23 self._anmrunner = ANMRunner(anm_wrapper, index, self._sprite)
24 self._anmrunner.run_frame()
25
26 self.offset_x = 0
27 self.offset_y = 0
28
29 self.player_state = player_state
30 self.fire = fire_func
31
32
33 @property
34 def x(self):
35 return self.player_state.x + self.offset_x
36
37
38 @property
39 def y(self):
40 return self.player_state.y + self.offset_y
41
42
43 def update(self):
44 self._anmrunner.run_frame()