diff --git a/mine-racer/mine-racer.py b/mine-racer/mine-racer.py deleted file mode 100755 index 4e134fd..0000000 --- a/mine-racer/mine-racer.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -from storm_games import * - -# Initial variable settings -gameName = "Mine Racer" -mode = "menu" -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 -mode = game_menu("start game", "credits", "exit_game") -while True: - # wait for an event - event = pygame.event.wait() - # if the event is about a keyboard button that have been pressed... - if event.type == pygame.KEYDOWN: - # Escape is the back/exit key, close the game if not playing, or return to menu if playing. - if event.key == pygame.K_ESCAPE: - 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_game") - if mode == "start game": game() - time.sleep(.001) - diff --git a/mine-racer/sounds/game-intro.ogg b/mine-racer/sounds/game-intro.ogg deleted file mode 100644 index dc372e9..0000000 Binary files a/mine-racer/sounds/game-intro.ogg and /dev/null differ diff --git a/mine-racer/sounds/jump.ogg b/mine-racer/sounds/jump.ogg deleted file mode 100644 index 3676b94..0000000 Binary files a/mine-racer/sounds/jump.ogg and /dev/null differ diff --git a/mine-racer/sounds/music_car.ogg b/mine-racer/sounds/music_car.ogg deleted file mode 100644 index 963f8fa..0000000 Binary files a/mine-racer/sounds/music_car.ogg and /dev/null differ diff --git a/mine-racer/sounds/music_menu.ogg b/mine-racer/sounds/music_menu.ogg deleted file mode 100644 index b6a7fb9..0000000 Binary files a/mine-racer/sounds/music_menu.ogg and /dev/null differ diff --git a/mine-racer/storm_games.py b/mine-racer/storm_games.py deleted file mode 100755 index 02599d5..0000000 --- a/mine-racer/storm_games.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- -"""Standard initializations and functions shared by all games.""" - -import os -from os import listdir -from os.path import isfile, join -from inspect import isfunction -import pygame -import speechd -import time - -spd = speechd.Client() -def speak(text, interupt = True): - if interupt == True: spd.cancel() - spd.say(text) - -def exit_game(): - spd.close() - pygame.quit() - exit() - -def initialize_gui(gameTitle): - # start pygame - pygame.init() - # start the display (required by the event loop) - pygame.display.set_mode((320, 200)) - pygame.display.set_caption(gameTitle) - # Load sounds from the sound directory and creates a list like that {'bottle': 'bottle.ogg'} - soundFiles = [f for f in listdir("sounds/") if isfile(join("sounds/", f)) and (f.split('.')[1].lower() in ["ogg","wav"])] - #lets make a dict with pygame.mixer.Sound() objects {'bottle':} - soundData = {} - for f in soundFiles: - soundData[f.split('.')[0]] = pygame.mixer.Sound("sounds/" + f) - soundData['game-intro'].play() - time.sleep(soundData['game-intro'].get_length()) - return soundData - -def game_menu(*options): - loop = True - pygame.mixer.music.load("sounds/music_menu.ogg") - pygame.mixer.music.set_volume(0.75) - pygame.mixer.music.play(-1) - i = 0 - speak(options[i]) - while loop == True: - event = pygame.event.wait() - if event.type == pygame.KEYDOWN: - if event.key == pygame.K_ESCAPE: exit_game() - 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: - try: - eval(options[i] + "()") - continue - except: - time.sleep(0.25) - return options[i] - continue - speak(options[i]) - event = pygame.event.clear() - time.sleep(0.001) - -def credits(): - 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.") - i = 0 - speak(info[i]) - while True: - event = pygame.event.wait() - if event.type == pygame.KEYDOWN: - if event.key == pygame.K_ESCAPE or event.key == pygame.K_RETURN: return - if event.key == pygame.K_DOWN and i < len(info) - 1: i = i + 1 - if event.key == pygame.K_UP and i > 0: i = i - 1 - speak(info[i]) - event = pygame.event.clear() - time.sleep(0.001) -