respect python formatting guidelines

This commit is contained in:
2019-05-22 04:53:22 -07:00
parent 0a1cae4d45
commit 52766667cf

39
main.py
View File

@@ -1,36 +1,42 @@
#!/usr/bin/python3 #!/usr/bin/python3
import contextlib import contextlib
with contextlib.redirect_stdout(None): #hide pygame welcome message with contextlib.redirect_stdout(None): # hide Pygame welcome message
import os, sys, pygame import os
import sys
import pygame
def confirmLeave(): def confirm_leave():
prompt = input("All progress will be lost, are you sure?: [y/N]: ") prompt = input("All progress will be lost, are you sure?: [y/N]: ")
if prompt == "n": if prompt == "n":
print("Staying in game") print("Staying in game")
elif prompt == "y": elif prompt == "y":
mainMenu() main_menu()
else: else:
print("That is not an option") print("That is not an option")
def navBar():
def nav_bar():
print(""" print("""
============================ ============================
[m] - Main Menu [m] - Main Menu
============================ ============================
""") """)
def clear():
os.system("clear") # Windows has no clear screen equivilent so use os.system
def lvlOne(): def clear():
os.system("clear") # Windows has no clear screen equivalent so use os.system
def lvl_one():
clear() clear()
navBar() nav_bar()
while True: while True:
print(""" print("""
@@ -50,7 +56,7 @@ def lvlOne():
prompt = input(">> ") prompt = input(">> ")
if prompt == "m": if prompt == "m":
confirmLeave() confirm_leave()
elif prompt == "q": elif prompt == "q":
sys.exit(0) sys.exit(0)
@@ -59,13 +65,12 @@ def lvlOne():
print("That key is not an option") print("That key is not an option")
def main_menu():
def mainMenu():
clear() clear()
pygame.init() pygame.init()
theme = pygame.mixer.music.load("big-booty-judy-drums.mp3") theme = pygame.mixer.music.load("big-booty-judy-drums.ogg")
pygame.mixer.music.play(loops=-1, start=0.0) pygame.mixer.music.play(loops=-1, start=0.0)
while 1==1: while 1 == 1:
print(""" print("""
____ _ ____ __ _ __ ____ _ ____ __ _ __
/ __ )(_)___ _ / __ )____ ____ / /___ __ (_)_ ______/ /_ __ / __ )(_)___ _ / __ )____ ____ / /___ __ (_)_ ______/ /_ __
@@ -105,13 +110,11 @@ def mainMenu():
if prompt == "s": if prompt == "s":
pygame.mixer.music.stop() pygame.mixer.music.stop()
pygame.quit() pygame.quit()
lvlOne() lvl_one()
elif prompt == "q": elif prompt == "q":
pygame.quit() pygame.quit()
sys.exit(0) sys.exit(0)
main_menu()
mainMenu()