Skip to content

Commit

Permalink
use sys exit instead of quit for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
WilsonOh committed Jun 26, 2022
1 parent 195a8a1 commit 8e527b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 98 deletions.
91 changes: 0 additions & 91 deletions enemies_test/main.py

This file was deleted.

13 changes: 7 additions & 6 deletions src/menu.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pygame
from assets import get_sprite_image, get_music, get_assets_path
import sys
from settings import load_settings

settings = load_settings()
Expand All @@ -19,13 +20,13 @@ def pause_screen():
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
pause_out_sound.play()
return
if event.key == pygame.K_q:
quit()
sys.exit()
window.fill(pygame.Color("white"))
"""
window.blit(
Expand Down Expand Up @@ -60,10 +61,10 @@ def menu():
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
quit()
sys.exit()
if event.key == pygame.K_RETURN:
pygame.mixer.Channel(1).play(menu_sound)
menu_music.fadeout(1000)
Expand All @@ -89,10 +90,10 @@ def win_screen():
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
quit()
sys.exit()
window.fill(pygame.Color("yellow"))
window.blit(
title, (win_center[0] - title_center[0], win_center[1] - title_center[1])
Expand Down
3 changes: 2 additions & 1 deletion src/player.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pygame
import random
import sys
from settings import load_settings
from assets import get_sprite_image, get_music
from animations import load_animation, change_action
Expand Down Expand Up @@ -98,7 +99,7 @@ def input(self):

if event.type == pygame.QUIT:
pygame.quit()
quit(0)
sys.exit()

def toggle_mute(self) -> None:
if not self.muted:
Expand Down

0 comments on commit 8e527b7

Please sign in to comment.