-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
46 lines (36 loc) · 1.3 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Rogue Dungeon
# Created by Alec Barker and Jacob Sanford
from menu_controllers import menu
class Main:
"""Acts as the main controller of the program."""
def __init__(self):
"""Creates a menu in the console that the user can select."""
_main_menu = menu.Menu()
# Prints the game logo.
print()
_main_menu.print_logo()
print()
# While the program is running, asks the player which menu option they want.
while True:
_main_menu.print_menu_options()
print()
_answer = input("Please enter a command: ").lower()
try:
func = _main_menu.menu_map[_answer]
except KeyError:
print()
print("'{}' is not a valid command.".format(_answer))
print()
else:
func()
# ======================================================== #
# Checks if the user has pygame installed.
# If so, it will run the program.
if __name__ == '__main__':
try:
import pygame
except ImportError:
print("Error: pygame not installed. Please type the following to install pygame on a Windows machine:")
print("py -m pip install -U pygame --user")
quit()
Main()