comparison pytouhou/games/eosd.py @ 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 da53bc29b94a
children f3099ebf4f61
comparison
equal deleted inserted replaced
302:34ea45d95489 303:647bde10353d
99 99
100 self.width = 640 100 self.width = 640
101 self.height = 480 101 self.height = 480
102 self.game_pos = (32, 16) 102 self.game_pos = (32, 16)
103 103
104 self.highscore = 1000000 #TODO: read score.dat
104 self.items = ([Effect((0, 32 * i), 6, front) for i in range(15)] + 105 self.items = ([Effect((0, 32 * i), 6, front) for i in range(15)] +
105 [Effect((416 + 32 * i, 32 * j), 6, front) for i in range(7) for j in range(15)] + 106 [Effect((416 + 32 * i, 32 * j), 6, front) for i in range(7) for j in range(15)] +
106 [Effect((32 + 32 * i, 0), 7, front) for i in range(12)] + 107 [Effect((32 + 32 * i, 0), 7, front) for i in range(12)] +
107 [Effect((32 + 32 * i, 464), 8, front) for i in range(12)] + 108 [Effect((32 + 32 * i, 464), 8, front) for i in range(12)] +
108 [Effect((0, 0), 5, front)] + 109 [Effect((0, 0), 5, front)] +
127 for elem in self.items: 128 for elem in self.items:
128 elem.update() 129 elem.update()
129 130
130 player_state = self.states[0] 131 player_state = self.states[0]
131 132
132 self.labels['score'].set_text('%09d' % player_state.score) 133 self.highscore = max(self.highscore, player_state.effective_score)
134 self.labels['highscore'].set_text('%09d' % self.highscore)
135 self.labels['score'].set_text('%09d' % player_state.effective_score)
133 self.labels['power'].set_text('%d' % player_state.power) 136 self.labels['power'].set_text('%d' % player_state.power)
134 self.labels['graze'].set_text('%d' % player_state.graze) 137 self.labels['graze'].set_text('%d' % player_state.graze)
135 self.labels['points'].set_text('%d' % player_state.points) 138 self.labels['points'].set_text('%d' % player_state.points)
136 139
137 140