forked from Telos4/RoboRally
implemented quitting the program
This commit is contained in:
parent
ff6caa457f
commit
8c544f8fcc
|
@ -1,7 +1,6 @@
|
|||
import numpy as np
|
||||
import random
|
||||
import pygame
|
||||
|
||||
import os
|
||||
|
||||
BLACK = np.array([0, 0, 0], dtype=np.uint8)
|
||||
|
@ -377,8 +376,10 @@ class Game:
|
|||
def process_inputs(self):
|
||||
# proceed events
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
self.state = 'quit'
|
||||
# handle MOUSEBUTTONUP
|
||||
if event.type == pygame.MOUSEBUTTONUP:
|
||||
elif event.type == pygame.MOUSEBUTTONUP:
|
||||
pos = pygame.mouse.get_pos()
|
||||
|
||||
# select command to edit by the programmer
|
||||
|
@ -439,6 +440,8 @@ class Game:
|
|||
self.state = self.prg.step()
|
||||
elif self.state == 'reset':
|
||||
self.state = self.reset()
|
||||
elif self.state == 'quit':
|
||||
running = False
|
||||
else:
|
||||
print("unknown state")
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue
Block a user