From f86cca398cd18722e70e735a6b96d47d1eeed5ab Mon Sep 17 00:00:00 2001 From: Patrick Tschuchnig Date: Tue, 27 Aug 2019 13:28:18 +0200 Subject: [PATCH] =?UTF-8?q?kleine=20=C3=A4nderungen=20an=20der=20struktur?= =?UTF-8?q?=20des=20programms,=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gametest.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/gametest.py b/gametest.py index 25dc9c7..39839b0 100644 --- a/gametest.py +++ b/gametest.py @@ -55,7 +55,6 @@ def toggle_fullscreen(): pygame.key.set_mods(0) #HACK: work-a-round for a SDL bug?? pygame.mouse.set_cursor( *cursor ) # Duoas 16-04-2007 - return screen def clearScreen(): @@ -83,8 +82,8 @@ def exit_application(): sys.exit() return -#def shutdown_raspberry(): - #os.system("sudo shutdown -h now") +def shutdown_raspberry(): + os.system("sudo shutdown -h now") return @@ -112,21 +111,20 @@ while True: # main loop while GPIO.input(startPin) == False: #wait for the user to press start button handle_events() - start_time = int(time.time()) errors = 0 errorAdded = False - justStarted = True + #justStarted = True + header_surface = font.render('Spiel startet', True, mainFontColor) + time.sleep(5) - header_surface = font.render('Spiel l' + u'รค' + 'uft!', True, mainFontColor) - + start_time = int(time.time()) while True: # game running handle_events() - if GPIO.input(errorPin) == True: if errorAdded == False: errors += 1 @@ -146,7 +144,6 @@ while True: # main loop errors_rectangle = errors_surface.get_rect() errors_rectangle.topleft = (0, 400) - clearScreen() screen.blit(errors_surface, errors_rectangle) #errors screen.blit(time_surface, time_rectangle) #time @@ -154,10 +151,12 @@ while True: # main loop pygame.display.flip() - if GPIO.input(startPin) == False: - justStarted = False - if GPIO.input(startPin) == True and justStarted == False: - break + #if GPIO.input(startPin) == False: + # justStarted = False + #if GPIO.input(startPin) == True and justStarted == False: + if GPIO.input(startPin) == True: + #break + continue #skip the rest clearScreen() header_surface = font.render('Game over!', True, mainFontColor) @@ -168,14 +167,15 @@ while True: # main loop pygame.display.flip() - while GPIO.input(startPin) == False: - handle_events() + #while GPIO.input(startPin) == False: + # handle_events() - while GPIO.input(startPin) == True: - handle_events() + #while GPIO.input(startPin) == True: + # handle_events() - while GPIO.input(startPin) == False: - handle_events() + #while GPIO.input(startPin) == False: + # handle_events() clearScreen() - time.sleep(1) + time.sleep(10) + break