changed the game start timer to be a one-shot in the game_ending routine. changed a spelling mistake in variable declaration.

This commit is contained in:
Patrick Tschuchnig 2019-09-11 11:27:43 +02:00
parent 72a08a23b6
commit 7e67391678

View File

@ -136,7 +136,7 @@ led_green = 0
led_blue = 0 led_blue = 0
############################################ ############################################
########## END OF INITIALISATION ########### ######## END OF PRE-INITIALISATION #########
############################################ ############################################
############################################ ############################################
@ -401,10 +401,11 @@ led_init()
game_running = False game_running = False
game_just_started = True game_just_started = True
game_ending == False game_ending = False
highscore_checked = False highscore_checked = False
pin_start_inhibit = False pin_start_inhibit = False
timer_game_ending_started = False
############################################ ############################################
########## END OF INITIALISATION ########### ########## END OF INITIALISATION ###########
@ -525,15 +526,21 @@ while True:
# change led colour to red # change led colour to red
change_led_colour(100,10,10) change_led_colour(100,10,10)
game_ending == True timer_game_ending_started = False
timer_game_ending_timout = pygame.time.get_ticks() game_ending = True
game_running = False
if game_ending == True: if game_running == False and game_ending == True:
print("game is ending") print("game is ending")
if highscore_checked == False: if highscore_checked == False:
check_highscores(int_time) check_highscores(int_time)
highscore_checked = True highscore_checked = True
if timer_game_ending_started == False:
timer_game_ending_timout = pygame.time.get_ticks()
timer_game_ending_started = True
clear_screen() clear_screen()
header_surface = pygame_font_1.render('Game over!', True, pygame_font_main_color) header_surface = pygame_font_1.render('Game over!', True, pygame_font_main_color)
@ -547,10 +554,10 @@ while True:
# nach dem spiel ist vor dem spiel # nach dem spiel ist vor dem spiel
if ((pygame.time.get_ticks()-timer_game_ending_timout)/1000) > 5: if ((pygame.time.get_ticks()-timer_game_ending_timout)/1000) > 5:
game_running = False
game_just_started = True game_just_started = True
game_ending = False game_ending = False
highscore_checked = False highscore_checked = False
timer_game_ending_started = False
pygame.display.update() pygame.display.update()
pygame_clock.tick(pygame_fps) pygame_clock.tick(pygame_fps)