From 16201be5eba438e68667204baeff70fb465c982e Mon Sep 17 00:00:00 2001 From: <vc2310@LAPTOP-FCB0H0KM.localdomain> Date: Tue, 16 Oct 2018 15:51:55 -0400 Subject: [PATCH] making quit button work --- BlankProjectTemplate/POC_Demo/Snake_Game.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/BlankProjectTemplate/POC_Demo/Snake_Game.py b/BlankProjectTemplate/POC_Demo/Snake_Game.py index d2a1819..471c02c 100644 --- a/BlankProjectTemplate/POC_Demo/Snake_Game.py +++ b/BlankProjectTemplate/POC_Demo/Snake_Game.py @@ -52,6 +52,14 @@ while True: pygame.draw.rect(game,[180,180,180], [650,550,130,55], 0) Quit = playgame_font.render('QUIT', True, (0, 0, 0)) game.blit(Quit,(650,550)) + if ( 650 <= mousepos[0] <= 650+130 and 550 <= mousepos[1] <= 550 +55): + #checks if the mouse is hovering over the button + #checking if the button is clicked + if mouseclick[0] == 1: + #print ("quiting") + #pygame.display.quit() + pygame.quit() + sys.exit() pygame.display.update() -- GitLab