-
Notifications
You must be signed in to change notification settings - Fork 0
/
EmBall.py
executable file
·47 lines (31 loc) · 1.12 KB
/
EmBall.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
47
#!/usr/bin/env python2.7
import os
from emball import Helpers
from emball.Helpers import *
from emball.GameWindow import MainGame
from optparse import OptionParser
#File hack to let the helper functions know where everything is
Helpers.set_dirs_relative(os.path.dirname(__file__))
def initParser ():
usage = "usage: ./Emball.py [options] [level_name]"
parser = OptionParser(usage)
parser.set_defaults(debug=False, logFile=getLogName())
parser.add_option ("-d", action="store_true", dest="debug",\
help = "Causes program to be run in debug mode")
parser.add_option ("-l", action="store", dest="logFile",\
help = "Causes debug messages to be logged")
return parser
def main():
#Do option parsing
parser = initParser()
options, args = parser.parse_args()
#Set helper constants
Helpers.DEBUG = options.debug
Helpers.LOG_FILE = options.logFile
if len(args) != 0:
level = args[0]
else:
level = "basic"
MainGame(level).gameLoop()
if __name__ == "__main__":
main()