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
mode = "menu"
gameName = "Mine Racer"
sounds = initialize_gui(gameName)
sounds = initialize_gui("Mine Racer")
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
mode = game_menu("start game", "credits", "exit")
mode = game_menu("start game", "credits", "exit_game")
while True:
# wait for an event
event = pygame.event.wait()
@ -20,5 +31,7 @@ while True:
if mode != "menu": mode = "menu"
if mode == "menu": exit_game()
# 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)

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_UP and i > 0: i = i - 1
if event.key == pygame.K_RETURN:
if isfunction(options[i]):
speak(options[i] + "() is a function.")
options[i]()
else:
speak(options[i] + "() is not a function.")
try:
eval(options[i] + "()")
continue
except:
return options[i]
continue
speak(options[i])
event = pygame.event.clear()
time.sleep(0.001)
def credits():
info = {
gameName + "brought to you by Storm Dragon",\
info = (
"Mine Racer: brought to you by Storm Dragon",\
"Billy Wolfe, designer and coder.",\
"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
speak(info[i])
while loop == True:
while True:
event = pygame.event.wait()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE or event.key == pygame.K_RETURN: return