fixed string literals, fixed time sometimes showing too many 0's in the seconds part

master
panki27 7 years ago
parent ddc8aa5111
commit 9379b4393a

@ -134,36 +134,38 @@ def setup_playfield(w, h, x, y):
def gameover(win): def gameover(win):
SCREEN.clear() SCREEN.clear()
if not win: if not win:
SCREEN.addstr(0, 0, ' ________________') SCREEN.addstr(0, 0, r' ________________')
SCREEN.addstr(1, 0, ' ____/ ( ( ) ) \___') SCREEN.addstr(1, 0, r' ____/ ( ( ) ) \___')
SCREEN.addstr(2, 0, ' /( ( ( ) _ )) ) )\ ') SCREEN.addstr(2, 0, r' /( ( ( ) _ )) ) )\ ')
SCREEN.addstr(3, 0, ' (( ( )( ) ) ( ) )') SCREEN.addstr(3, 0, r' (( ( )( ) ) ( ) )')
SCREEN.addstr(4, 0, ' ((/ ( _( ) ( _) ) ( () ) )') SCREEN.addstr(4, 0, r' ((/ ( _( ) ( _) ) ( () ) )')
SCREEN.addstr(5, 0, ' ( ( ( (_) (( ( ) .((_ ) . )_') SCREEN.addstr(5, 0, r' ( ( ( (_) (( ( ) .((_ ) . )_')
SCREEN.addstr(6, 0, ' ( ( ) ( ( ) ) ) . ) ( )') SCREEN.addstr(6, 0, r' ( ( ) ( ( ) ) ) . ) ( )')
SCREEN.addstr(7, 0, ' ( ( ( ( ) ( _ ( _) ). ) . ) ) ( )') SCREEN.addstr(7, 0, r' ( ( ( ( ) ( _ ( _) ). ) . ) ) ( )')
SCREEN.addstr(8, 0, ' ( ( ( ) ( ) ( )) ) _)( ) ) )') SCREEN.addstr(8, 0, r' ( ( ( ) ( ) ( )) ) _)( ) ) )')
SCREEN.addstr(9, 0, ' ( ( ( \ ) ( (_ ( ) ( ) ) ) ) )) ( )') SCREEN.addstr(9, 0, r' ( ( ( \ ) ( (_ ( ) ( ) ) ) ) )) ( )')
SCREEN.addstr(10, 0, ' ( ( ( ( (_ ( ) ( _ ) ) ( ) ) )') SCREEN.addstr(10, 0, r' ( ( ( ( (_ ( ) ( _ ) ) ( ) ) )')
SCREEN.addstr(11, 0, ' ( ( ( ( ( ) (_ ) ) ) _) ) _( ( )') SCREEN.addstr(11, 0, r' ( ( ( ( ( ) (_ ) ) ) _) ) _( ( )')
SCREEN.addstr(12, 0, ' (( ( )( ( _ ) _) _(_ ( (_ )') SCREEN.addstr(12, 0, r' (( ( )( ( _ ) _) _(_ ( (_ )')
SCREEN.addstr(13, 0, ' (_((__(_(__(( ( ( | ) ) ) )_))__))_)___)') SCREEN.addstr(13, 0, r' (_((__(_(__(( ( ( | ) ) ) )_))__))_)___)')
SCREEN.addstr(14, 0, ' ((__) \\||lll|l||/// \_))') SCREEN.addstr(14, 0, r' ((__) \\||lll|l||/// \_))')
SCREEN.addstr(15, 0, ' ( /(/ ( ) ) )\ )') SCREEN.addstr(15, 0, r' ( /(/ ( ) ) )\ )')
SCREEN.addstr(16, 0, ' ( ( ( ( | | ) ) )\ )') SCREEN.addstr(16, 0, r' ( ( ( ( | | ) ) )\ )')
SCREEN.addstr(17, 0, ' ( /(| / ( )) ) ) )) )') SCREEN.addstr(17, 0, r' ( /(| / ( )) ) ) )) )')
SCREEN.addstr(18, 0, ' ( ( ((((_(|)_))))) )') SCREEN.addstr(18, 0, r' ( ( ((((_(|)_))))) )')
SCREEN.addstr(19, 0, ' ( ||\(|(|)|/|| )') SCREEN.addstr(19, 0, r' ( ||\(|(|)|/|| )')
SCREEN.addstr(20, 0, ' ( |(||(||)|||| )') SCREEN.addstr(20, 0, r' ( |(||(||)|||| )')
SCREEN.addstr(21, 0, ' ( //|/l|||)|\\ \ )') SCREEN.addstr(21, 0, r' ( //|/l|||)|\\ \ )')
SCREEN.addstr(22, 0, ' (/ / // /|//||||\\ \ \ \ _)') SCREEN.addstr(22, 0, r' (/ / // /|//||||\\ \ \ \ _)')
SCREEN.addstr(23, 0, ' You lose! Press Q to quit, or R to restart!') SCREEN.addstr(23, 0, ' You lose! Press Q to quit, or R to restart!')
else: else:
now = time.time() now = time.time()
elapsed = now - STARTTIME elapsed = now - STARTTIME
mins = elapsed / 60 mins = elapsed / 60
secs = elapsed % 60 secs = elapsed % 60
winstr = 'You win! It took you {}:{} to bash the field!'.format(int(mins), str(round(secs, 2)).zfill(5)) secstr = str(round(secs, 2))
while len(secstr) < 4: secstr += '0' #to avoid a time of 0:001.5
winstr = 'You win! It took you {}:{} to bash the field!'.format(int(mins), secstr.zfill(5)).zfill(7)
SCREEN.addstr(0, 0, ' /$$ /$$ /$$ /$$ /$$$$$$$ /$$') SCREEN.addstr(0, 0, ' /$$ /$$ /$$ /$$ /$$$$$$$ /$$')
SCREEN.addstr(1, 0, '| $$ /$ | $$ | $$| $$ | $$__ $$ | $$') SCREEN.addstr(1, 0, '| $$ /$ | $$ | $$| $$ | $$__ $$ | $$')
SCREEN.addstr(2, 0, '| $$ /$$$| $$ /$$$$$$ | $$| $$ | $$ \ $$ /$$$$$$ /$$$$$$$ /$$$$$$ | $$') SCREEN.addstr(2, 0, '| $$ /$$$| $$ /$$$$$$ | $$| $$ | $$ \ $$ /$$$$$$ /$$$$$$$ /$$$$$$ | $$')

Loading…
Cancel
Save