comparison gamelib/gameover.py @ 564:fb8ab1ee3eaf

Use actual username in high scores.
author Simon Cross <hodgestar@gmail.com>
date Sat, 28 Nov 2009 19:15:25 +0000
parents 80725d647569
children a8dde729000a
comparison
equal deleted inserted replaced
563:06f2f965ea4f 564:fb8ab1ee3eaf
1 """The Game Over Screen""" 1 """The Game Over Screen"""
2 import random 2 import random
3 import os 3 import os
4 import getpass
4 5
5 from pgu import gui 6 from pgu import gui
6 from pgu import html 7 from pgu import html
7 from pgu.high import Highs 8 from pgu.high import Highs
8 import pygame 9 import pygame
98 99
99 made_list = scoreboard.check(score) is not None 100 made_list = scoreboard.check(score) is not None
100 if level.is_game_over(gameboard): 101 if level.is_game_over(gameboard):
101 if len(gameboard.chickens) > 0: 102 if len(gameboard.chickens) > 0:
102 self.survived = WON 103 self.survived = WON
103 scoreboard.submit(score, 'Player') 104 try:
105 player = getpass.getuser()
106 except Exception:
107 player = 'You'
108 scoreboard.submit(score, player)
104 message = random.choice(WON_MESSAGES) 109 message = random.choice(WON_MESSAGES)
105 else: 110 else:
106 self.survived = LOST 111 self.survived = LOST
107 message = random.choice(LOST_MESSAGES) 112 message = random.choice(LOST_MESSAGES)
108 else: 113 else: