Browse Source

Enhanced exiting behaviour

master
klonfish 8 years ago committed by klonfish
parent
commit
009a4973f1
  1. 21
      gamemenu.py

21
gamemenu.py

@ -325,7 +325,12 @@ if __name__ == '__main__':
inp1 = BalanceInput((host, int(port)), 0) inp1 = BalanceInput((host, int(port)), 0)
inp2 = BalanceInput((host, int(port)), 1) inp2 = BalanceInput((host, int(port)), 1)
while inp1.get_event() != InputEvent.STEP_ON: while True:
evt = inp1.get_event()
if evt == InputEvent.STEP_ON:
break
elif evt == InputEvent.QUIT:
sys.exit()
time.sleep(0.05) time.sleep(0.05)
init_frame = create_init_screen(dim) init_frame = create_init_screen(dim)
@ -363,11 +368,15 @@ if __name__ == '__main__':
wait_time = 3 wait_time = 3
start = time.time() start = time.time()
while time.time() < start+wait_time: while time.time() < start+wait_time:
if inp2.get_event() == InputEvent.STEP_ON: while True:
inp1.running = False evt = inp2.get_event()
inp2.running = False if evt == InputEvent.STEP_ON:
start_game(game, 2) inp1.running = False
time.sleep(0.1) inp2.running = False
start_game(game, 2)
elif evt == InputEvent.QUIT:
sys.exit()
time.sleep(0.1)
inp1.running = False inp1.running = False
inp2.running = False inp2.running = False

Loading…
Cancel
Save