changeset 495:b32cef75df59

Drop an useless dependency on Player from Orb, on Game from Laser.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 14 Oct 2013 12:12:52 +0200
parents 6be9c99a3a24
children 104c737ce8b3
files pytouhou/game/itemtype.py pytouhou/game/laser.pxd pytouhou/game/laser.pyx pytouhou/game/orb.pxd
diffstat 4 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/game/itemtype.py
+++ b/pytouhou/game/itemtype.py
@@ -1,5 +1,3 @@
-from pytouhou.game.sprite import Sprite
-
 class ItemType(object):
     def __init__(self, anm, sprite_index, indicator_sprite_index):
         self.anm = anm
--- a/pytouhou/game/laser.pxd
+++ b/pytouhou/game/laser.pxd
@@ -1,6 +1,5 @@
 from pytouhou.game.element cimport Element
 from pytouhou.game.sprite cimport Sprite
-from pytouhou.game.game cimport Game
 from pytouhou.game.lasertype cimport LaserType
 
 cdef enum State:
@@ -21,7 +20,6 @@ cdef class Laser(Element):
     cdef unsigned long grazing_extra_duration, sprite_idx_offset
     cdef double base_pos[2], speed, start_offset, end_offset, max_length, width
     cdef State state
-    cdef Game _game
     cdef LaserType _laser_type
 
     cdef void set_anim(self, long sprite_idx_offset=*) except *
--- a/pytouhou/game/laser.pyx
+++ b/pytouhou/game/laser.pyx
@@ -14,6 +14,7 @@
 
 from libc.math cimport cos, sin, M_PI as pi
 
+from pytouhou.game.game cimport Game
 from pytouhou.vm.anmrunner import ANMRunner
 
 
@@ -56,11 +57,10 @@ cdef class Laser(Element):
                  unsigned long grazing_extra_duration, Game game):
         Element.__init__(self, (0, 0))
 
-        self._game = game
         launch_anim = LaserLaunchAnim(self, laser_type.anm,
                                       laser_type.launch_anim_offsets[sprite_idx_offset]
                                       + laser_type.launch_sprite_idx)
-        self._game.effects.append(launch_anim)
+        game.effects.append(launch_anim)
         self._laser_type = laser_type
         self.state = STARTING
 
--- a/pytouhou/game/orb.pxd
+++ b/pytouhou/game/orb.pxd
@@ -1,10 +1,9 @@
 from pytouhou.game.element cimport Element
 from pytouhou.game.sprite cimport Sprite
-from pytouhou.game.player cimport Player
 
 cdef class Orb(Element):
     cdef public double offset_x, offset_y
-    cdef Player player
+    cdef Element player
     cdef object fire
 
     cpdef update(self)