comparison pytouhou/game/game.py @ 143:ea21bb37febe

Add max bullets limit
author Thibaut Girka <thib@sitedethib.com>
date Sun, 25 Sep 2011 21:00:43 +0200
parents c7f0fd9d2145
children 4f46717390aa
comparison
equal deleted inserted replaced
142:c7f0fd9d2145 143:ea21bb37febe
21 from pytouhou.game.enemy import Enemy 21 from pytouhou.game.enemy import Enemy
22 22
23 23
24 class GameState(object): 24 class GameState(object):
25 __slots__ = ('resource_loader', 'bullets', 'players', 'rank', 'difficulty', 'frame', 25 __slots__ = ('resource_loader', 'bullets', 'players', 'rank', 'difficulty', 'frame',
26 'stage', 'boss', 'prng', 'bullet_types', 'characters') 26 'stage', 'boss', 'prng', 'bullet_types', 'characters', 'nb_bullets_max')
27 def __init__(self, resource_loader, players, stage, rank, difficulty, 27 def __init__(self, resource_loader, players, stage, rank, difficulty,
28 bullet_types, characters): 28 bullet_types, characters, nb_bullets_max):
29 self.resource_loader = resource_loader 29 self.resource_loader = resource_loader
30 30
31 self.bullet_types = bullet_types 31 self.bullet_types = bullet_types
32 self.characters = characters 32 self.characters = characters
33 33
34 self.bullets = [] 34 self.bullets = []
35 self.nb_bullets_max = nb_bullets_max
35 36
36 self.stage = stage 37 self.stage = stage
37 self.players = players 38 self.players = players
38 self.rank = rank 39 self.rank = rank
39 self.difficulty = difficulty 40 self.difficulty = difficulty
43 44
44 45
45 46
46 class Game(object): 47 class Game(object):
47 def __init__(self, resource_loader, player_states, stage, rank, difficulty, 48 def __init__(self, resource_loader, player_states, stage, rank, difficulty,
48 bullet_types, characters): 49 bullet_types, characters, nb_bullets_max=None):
49 self.game_state = GameState(resource_loader, player_states, stage, 50 self.game_state = GameState(resource_loader, player_states, stage,
50 rank, difficulty, 51 rank, difficulty,
51 bullet_types, characters) 52 bullet_types, characters, nb_bullets_max)
52 53
53 self.players = [Player(player_state, characters[player_state.character]) for player_state in player_states] 54 self.players = [Player(player_state, characters[player_state.character]) for player_state in player_states]
54 self.enemies = [] 55 self.enemies = []
55 56
56 self.bonuses = [] 57 self.bonuses = []