Mercurial > touhou
changeset 303:647bde10353d
Add score/effective_score distinction and prepare for highscore handling.
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sat, 10 Mar 2012 20:37:15 +0100 |
parents | 34ea45d95489 |
children | f3099ebf4f61 |
files | pytouhou/game/game.py pytouhou/game/player.py pytouhou/games/eosd.py |
diffstat | 3 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pytouhou/game/game.py +++ b/pytouhou/game/game.py @@ -117,6 +117,8 @@ class Game(object): player = self.players[0] #TODO if _type > 6: return + if len(self.items) >= self.nb_bullets_max: + return #TODO: check item_type = self.item_types[_type] item = Item((x, y), _type, item_type, self, end_pos=end_pos) self.items.append(item) @@ -234,6 +236,11 @@ class Game(object): for bullet in self.players_bullets: bullet.update() + #XXX: Why 78910? Is it really the right value? + player.state.effective_score = min(player.state.effective_score + 78910, + player.state.score) + #TODO: give extra lives to the player + def update_effects(self): for effect in self.effects:
--- a/pytouhou/game/player.py +++ b/pytouhou/game/player.py @@ -28,6 +28,7 @@ class PlayerState(object): self.character = character # ReimuA/ReimuB/MarisaA/MarisaB/... self.score = score + self.effective_score = score self.lives = lives self.bombs = bombs self.power = power
--- a/pytouhou/games/eosd.py +++ b/pytouhou/games/eosd.py @@ -101,6 +101,7 @@ class EoSDInterface(Game): self.height = 480 self.game_pos = (32, 16) + self.highscore = 1000000 #TODO: read score.dat self.items = ([Effect((0, 32 * i), 6, front) for i in range(15)] + [Effect((416 + 32 * i, 32 * j), 6, front) for i in range(7) for j in range(15)] + [Effect((32 + 32 * i, 0), 7, front) for i in range(12)] + @@ -129,7 +130,9 @@ class EoSDInterface(Game): player_state = self.states[0] - self.labels['score'].set_text('%09d' % player_state.score) + self.highscore = max(self.highscore, player_state.effective_score) + self.labels['highscore'].set_text('%09d' % self.highscore) + self.labels['score'].set_text('%09d' % player_state.effective_score) self.labels['power'].set_text('%d' % player_state.power) self.labels['graze'].set_text('%d' % player_state.graze) self.labels['points'].set_text('%d' % player_state.points)