menu system in progress. Sounds for game added. More to come.
This commit is contained in:
parent
7aec6306e5
commit
343a829e37
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
mine-racer/sounds/jump.ogg
Normal file
BIN
mine-racer/sounds/jump.ogg
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
mine-racer/sounds/music_car.ogg
Normal file
BIN
mine-racer/sounds/music_car.ogg
Normal file
Binary file not shown.
BIN
mine-racer/sounds/music_menu.ogg
Normal file
BIN
mine-racer/sounds/music_menu.ogg
Normal file
Binary file not shown.
@ -9,9 +9,7 @@ import pygame
|
||||
import speechd
|
||||
import time
|
||||
|
||||
def __init__():
|
||||
spd = speechd.Client()
|
||||
|
||||
spd = speechd.Client()
|
||||
def speak(text, interupt = True):
|
||||
if interupt == True: spd.cancel()
|
||||
spd.say(text)
|
||||
@ -37,3 +35,20 @@ def initialize_gui(gameTitle):
|
||||
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.play(-1)
|
||||
i = 0
|
||||
speak(options[i])
|
||||
while loop == True:
|
||||
event = pygame.event.wait()
|
||||
if event.key == pygame.K_ESCAPE: exit_game()
|
||||
if event.key == pygame.K_DOWN and i < len(options) - 1:
|
||||
i = i + 1
|
||||
speak(options[i])
|
||||
if event.key == pygame.K_UP and i > 0:
|
||||
i = i - 1
|
||||
speak(options[i])
|
||||
event = pygame.event.clear()
|
||||
time.sleep(0.001)
|
||||
|
Binary file not shown.
@ -13,6 +13,7 @@ while True:
|
||||
# if the event is about a keyboard button that have been pressed...
|
||||
if event.type == pygame.KEYDOWN:
|
||||
sounds['bottle'].play(-1)
|
||||
speak("This is a test.")
|
||||
if event.type == pygame.KEYUP:
|
||||
sounds['bottle'].stop()
|
||||
# and if the button is the "q" letter or the "escape" key...
|
||||
|
@ -2,13 +2,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Standard initializations and functions shared by all games."""
|
||||
|
||||
from espeak import espeak
|
||||
import os
|
||||
from os import listdir
|
||||
from os.path import isfile, join
|
||||
import pygame
|
||||
import time
|
||||
|
||||
SoundFolder = 'sounds'
|
||||
def speak(text, interupt = True):
|
||||
if interupt == True: espeak.cancel()
|
||||
espeak.set_voice("en-us")
|
||||
espeak.synth(text)
|
||||
|
||||
def initialize_gui(gameTitle):
|
||||
# start pygame
|
||||
|
Loading…
Reference in New Issue
Block a user