comparison pytouhou/game/bullet.pyx @ 390:b11953cf1d3b

Use only half-size hitboxes for player.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 12 Nov 2012 18:34:24 +0100
parents ac2891afb0bb
children efae61ad6efe
comparison
equal deleted inserted replaced
389:eef492100f4c 390:b11953cf1d3b
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, objects 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, 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,
35 player_bullet=False, damage=0, hitbox=None): 35 player_bullet=False, damage=0, hitbox=None):
41 self.removed = False 41 self.removed = False
42 self.was_visible = True 42 self.was_visible = True
43 self.objects = [self] 43 self.objects = [self]
44 44
45 if hitbox: 45 if hitbox:
46 self.hitbox_half_size = (hitbox[0] / 2., hitbox[1] / 2.) 46 self.hitbox = (hitbox[0], hitbox[1])
47 else: 47 else:
48 self.hitbox_half_size = (bullet_type.hitbox_size / 2., bullet_type.hitbox_size / 2.) 48 self.hitbox = (bullet_type.hitbox_size, bullet_type.hitbox_size)
49 49
50 self.speed_interpolator = None 50 self.speed_interpolator = None
51 self.frame = 0 51 self.frame = 0
52 self.grazed = False 52 self.grazed = False
53 53