comparison pytouhou/game/bullet.pyx @ 384:690b5faaa0e6

Make rendering of multiple-sprites elements work like single-sprites.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 02 Oct 2012 13:27:05 +0200
parents b5ab2ad06de8
children ac2891afb0bb
comparison
equal deleted inserted replaced
383:0537af9125a7 384:690b5faaa0e6
24 cdef class Bullet(object): 24 cdef class Bullet(object):
25 cdef public unsigned int state, flags, frame, sprite_idx_offset 25 cdef public unsigned int state, flags, frame, sprite_idx_offset
26 cdef public double dx, dy, angle, speed #TODO 26 cdef public double dx, dy, angle, speed #TODO
27 cdef public object player_bullet, target 27 cdef public object player_bullet, target
28 cdef public object _game, _bullet_type 28 cdef public object _game, _bullet_type
29 cdef public object sprite, anmrunner, removed, was_visible 29 cdef public object sprite, anmrunner, removed, was_visible, objects
30 cdef public object attributes, damage, hitbox_half_size, speed_interpolator, grazed 30 cdef public object attributes, damage, hitbox_half_size, speed_interpolator, grazed
31 cdef public object x, y #TODO 31 cdef public object x, y #TODO
32 32
33 def __init__(self, pos, bullet_type, sprite_idx_offset, 33 def __init__(self, pos, bullet_type, sprite_idx_offset,
34 angle, speed, attributes, flags, target, game, 34 angle, speed, attributes, flags, target, game,
38 self.state = LAUNCHING 38 self.state = LAUNCHING
39 self.sprite = None 39 self.sprite = None
40 self.anmrunner = None 40 self.anmrunner = None
41 self.removed = False 41 self.removed = False
42 self.was_visible = True 42 self.was_visible = True
43 self.objects = [self]
43 44
44 if hitbox: 45 if hitbox:
45 self.hitbox_half_size = (hitbox[0] / 2., hitbox[1] / 2.) 46 self.hitbox_half_size = (hitbox[0] / 2., hitbox[1] / 2.)
46 else: 47 else:
47 self.hitbox_half_size = (bullet_type.hitbox_size / 2., bullet_type.hitbox_size / 2.) 48 self.hitbox_half_size = (bullet_type.hitbox_size / 2., bullet_type.hitbox_size / 2.)