Mercurial > touhou
comparison pytouhou/game/enemy.pyx @ 471:06f0eeb519bb
Make Laser and Orb extension types, and use that where possible.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Mon, 16 Sep 2013 18:42:04 +0200 |
parents | feecdb4a8928 |
children | 2f53be1b2f60 |
comparison
equal
deleted
inserted
replaced
470:98995d8ac744 | 471:06f0eeb519bb |
---|---|
15 from libc.math cimport cos, sin, atan2, M_PI as pi | 15 from libc.math cimport cos, sin, atan2, M_PI as pi |
16 | 16 |
17 from pytouhou.vm.anmrunner import ANMRunner | 17 from pytouhou.vm.anmrunner import ANMRunner |
18 from pytouhou.game.sprite import Sprite | 18 from pytouhou.game.sprite import Sprite |
19 from pytouhou.game.bullet cimport Bullet, LAUNCHED | 19 from pytouhou.game.bullet cimport Bullet, LAUNCHED |
20 from pytouhou.game.laser import Laser | 20 from pytouhou.game.laser cimport Laser, PlayerLaser |
21 from pytouhou.game.effect cimport Effect | 21 from pytouhou.game.effect cimport Effect |
22 | 22 |
23 | 23 |
24 cdef class Enemy(Element): | 24 cdef class Enemy(Element): |
25 def __init__(self, pos, long life, long _type, long bonus_dropped, long die_score, anms, Game game): | 25 def __init__(self, pos, long life, long _type, long bonus_dropped, long die_score, anms, Game game): |
299 | 299 |
300 | 300 |
301 cdef void check_collisions(self): | 301 cdef void check_collisions(self): |
302 cdef Bullet bullet | 302 cdef Bullet bullet |
303 cdef Player player | 303 cdef Player player |
304 cdef PlayerLaser laser | |
304 cdef long damages | 305 cdef long damages |
305 cdef double half_size[2], lx, ly, phalf_size | 306 cdef double half_size[2], phalf_size |
306 | 307 |
307 # Check for collisions | 308 # Check for collisions |
308 ex, ey = self.x, self.y | 309 ex, ey = self.x, self.y |
309 ehalf_size_x = self.hitbox_half_size[0] | 310 ehalf_size_x = self.hitbox_half_size[0] |
310 ehalf_size_y = self.hitbox_half_size[1] | 311 ehalf_size_y = self.hitbox_half_size[1] |