comparison pytouhou/game/game.py @ 445:b0abb05811f7

Make pytouhou.game.player an extension type, and move the GameOver exception there since it makes more sense.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 17 Aug 2013 04:44:28 +0200
parents c9433188ffdb
children 3a33ed7f3b85
comparison
equal deleted inserted replaced
444:f26c8ab57257 445:b0abb05811f7
20 from pytouhou.game.enemy import Enemy 20 from pytouhou.game.enemy import Enemy
21 from pytouhou.game.item import Item 21 from pytouhou.game.item import Item
22 from pytouhou.game.effect import Effect, Particle 22 from pytouhou.game.effect import Effect, Particle
23 from pytouhou.game.text import Text 23 from pytouhou.game.text import Text
24 from pytouhou.game.face import Face 24 from pytouhou.game.face import Face
25
26
27
28 class GameOver(Exception):
29 pass
30 25
31 26
32 class Game(object): 27 class Game(object):
33 def __init__(self, players, stage, rank, difficulty, bullet_types, 28 def __init__(self, players, stage, rank, difficulty, bullet_types,
34 laser_types, item_types, nb_bullets_max=None, width=384, 29 laser_types, item_types, nb_bullets_max=None, width=384,
340 335
341 for player in self.players: 336 for player in self.players:
342 if not player.state.touchable: 337 if not player.state.touchable:
343 continue 338 continue
344 339
345 px, py = player.x, player.y 340 px, py = player.state.x, player.state.y
346 phalf_size = player.sht.hitbox 341 phalf_size = player.sht.hitbox
347 px1, px2 = px - phalf_size, px + phalf_size 342 px1, px2 = px - phalf_size, px + phalf_size
348 py1, py2 = py - phalf_size, py + phalf_size 343 py1, py2 = py - phalf_size, py + phalf_size
349 344
350 ghalf_size = player.sht.graze_hitbox 345 ghalf_size = player.sht.graze_hitbox