comparison pytouhou/game/game.py @ 220:0595315d3880

Fix SHT handling; change a few things to be closer to ZUN’s mind; and first stub of PCB support.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 18 Dec 2011 14:14:32 +0100
parents 577f45454402
children 2d35565b5608
comparison
equal deleted inserted replaced
219:091301805cce 220:0595315d3880
214 gy1, gy2 = py - ghalf_size, py + ghalf_size 214 gy1, gy2 = py - ghalf_size, py + ghalf_size
215 215
216 for bullet in self.bullets: 216 for bullet in self.bullets:
217 half_size = bullet.hitbox_half_size 217 half_size = bullet.hitbox_half_size
218 bx, by = bullet.x, bullet.y 218 bx, by = bullet.x, bullet.y
219 bx1, bx2 = bx - half_size, bx + half_size 219 bx1, bx2 = bx - half_size[0], bx + half_size[0]
220 by1, by2 = by - half_size, by + half_size 220 by1, by2 = by - half_size[1], by + half_size[1]
221 221
222 if not (bx2 < px1 or bx1 > px2 222 if not (bx2 < px1 or bx1 > px2
223 or by2 < py1 or by1 > py2): 223 or by2 < py1 or by1 > py2):
224 bullet.collide() 224 bullet.collide()
225 if player.state.invulnerable_time == 0: 225 if player.state.invulnerable_time == 0:
245 bx1, bx2 = bx - half_size, bx + half_size 245 bx1, bx2 = bx - half_size, bx + half_size
246 by1, by2 = by - half_size, by + half_size 246 by1, by2 = by - half_size, by + half_size
247 247
248 if not (bx2 < px1 or bx1 > px2 248 if not (bx2 < px1 or bx1 > px2
249 or by2 < py1 or by1 > py2): 249 or by2 < py1 or by1 > py2):
250 item.on_collect(player.state) 250 item.on_collect(player)
251 251
252 252
253 def cleanup(self): 253 def cleanup(self):
254 # Filter out non-visible enemies 254 # Filter out non-visible enemies
255 for enemy in tuple(self.enemies): 255 for enemy in tuple(self.enemies):