SZI2019SmieciarzWmi/config.py
2019-03-25 16:10:51 +01:00

28 lines
760 B
Python

import sys
import getopt
from sprites.cell import CELL_SIZE
def set_home_amount():
arguments = sys.argv[1:]
try:
optlist, args = getopt.getopt(arguments, '', ['home-count='])
for o, amount in optlist:
if o == '--home-count':
if int(amount) < 2:
print('Home count too low - must be higher than 2')
sys.exit(2)
return int(amount)
print('Missing argument: --home-count <amount>')
sys.exit(2)
except getopt.GetoptError as err:
print(err)
sys.exit(2)
home_amount = set_home_amount()
PLAY_WIDTH = (home_amount+2)*CELL_SIZE
PLAY_HEIGHT = PLAY_WIDTH
HUD_HEIGHT = int(home_amount*CELL_SIZE/4)