preparing to start work on the actual game. woot.

This commit is contained in:
Storm dragon 2016-03-23 17:23:16 -04:00
parent 870b8b39c0
commit fe3a2102bd
2 changed files with 26 additions and 13 deletions

View File

@ -5,11 +5,22 @@ from storm_games import *
# Initial variable settings # Initial variable settings
mode = "menu" mode = "menu"
gameName = "Mine Racer" sounds = initialize_gui("Mine Racer")
sounds = initialize_gui(gameName)
def game():
pygame.mixer.music.load("sounds/music_car.ogg")
gameOver = False
jump = False
points = 0
position = 0
while not gameOver:
if pygame.mixer.music.get_busy() == 0 and jump == False: pygame.mixer.music.play(-1)
event = pygame.event.wait()
time.sleep(10)
exit_game()
# Game starts at main menu # Game starts at main menu
mode = game_menu("start game", "credits", "exit") mode = game_menu("start game", "credits", "exit_game")
while True: while True:
# wait for an event # wait for an event
event = pygame.event.wait() event = pygame.event.wait()
@ -20,5 +31,7 @@ while True:
if mode != "menu": mode = "menu" if mode != "menu": mode = "menu"
if mode == "menu": exit_game() if mode == "menu": exit_game()
# Call the game menu, if needed. # Call the game menu, if needed.
if mode == "menu": mode = game_menu("start game", "credits", "exit") if mode == "menu": mode = game_menu("start game", "credits", "exit_game")
if mode == "start game": game()
time.sleep(.001) time.sleep(.001)

View File

@ -49,25 +49,25 @@ def game_menu(*options):
if event.key == pygame.K_DOWN and i < len(options) - 1: i = i + 1 if event.key == pygame.K_DOWN and i < len(options) - 1: i = i + 1
if event.key == pygame.K_UP and i > 0: i = i - 1 if event.key == pygame.K_UP and i > 0: i = i - 1
if event.key == pygame.K_RETURN: if event.key == pygame.K_RETURN:
if isfunction(options[i]): try:
speak(options[i] + "() is a function.") eval(options[i] + "()")
options[i]() continue
else: except:
speak(options[i] + "() is not a function.")
return options[i] return options[i]
continue
speak(options[i]) speak(options[i])
event = pygame.event.clear() event = pygame.event.clear()
time.sleep(0.001) time.sleep(0.001)
def credits(): def credits():
info = { info = (
gameName + "brought to you by Storm Dragon",\ "Mine Racer: brought to you by Storm Dragon",\
"Billy Wolfe, designer and coder.",\ "Billy Wolfe, designer and coder.",\
"http://stormdragon.tk",\ "http://stormdragon.tk",\
"Press escape or enter to return to the game menu."} "Press escape or enter to return to the game menu.")
i = 0 i = 0
speak(info[i]) speak(info[i])
while loop == True: while True:
event = pygame.event.wait() event = pygame.event.wait()
if event.type == pygame.KEYDOWN: if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE or event.key == pygame.K_RETURN: return if event.key == pygame.K_ESCAPE or event.key == pygame.K_RETURN: return