Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:v21/Sweareoke
Browse files Browse the repository at this point in the history
  • Loading branch information
George Buckenham committed Sep 5, 2010
2 parents 9e1a546 + c5113f7 commit 88b2ebc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion game.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def init(self):
self.display.init() self.display.init()
self.display.load_title() self.display.load_title()
self.song = pygame.mixer.music.load(self.filename) self.song = pygame.mixer.music.load(self.filename)
pygame.mixer.music.set_volume(0.4)
if (pygame.joystick.get_count() > 0): if (pygame.joystick.get_count() > 0):
self.guitar = pygame.joystick.Joystick(0) self.guitar = pygame.joystick.Joystick(0)
self.guitar.init() self.guitar.init()
Expand Down Expand Up @@ -84,6 +85,7 @@ def init(self):




word.sound = pygame.mixer.Sound(word.audiofile) word.sound = pygame.mixer.Sound(word.audiofile)
word.sound.set_volume(0.2)


self.get_swears() self.get_swears()


Expand All @@ -95,11 +97,13 @@ def get_swears(self):
word.resp = self.forvo.queryWord(word.text) word.resp = self.forvo.queryWord(word.text)
word.audiofile = self.forvo.fetchRecording(word.resp,0, word.resp.word) word.audiofile = self.forvo.fetchRecording(word.resp,0, word.resp.word)
word.audiofile = self.forvo.postprocessAudio(word.audiofile) word.audiofile = self.forvo.postprocessAudio(word.audiofile)
word.sound = pygame.mixer.Sound(word.audiofile)
word.sound.set_volume(1)
self.swears.append(word)
except: except:
print "no swear " + swear print "no swear " + swear
continue continue


self.swears.append(word)


def synthesize_word(self, word): def synthesize_word(self, word):
word_text_file = "tmp_word.txt" word_text_file = "tmp_word.txt"
Expand Down Expand Up @@ -145,6 +149,13 @@ def correct(self, word):
self.display.correct(word.column) self.display.correct(word.column)


def incorrect(self, column): def incorrect(self, column):
swear = self.swears[randint(0,len(self.swears)-1)]
try:
print " play swear"
channel = swear.sound.play()
except:
print "cant play swear"
pass
self.display.incorrect(column) self.display.incorrect(column)


def check_words(self, time): def check_words(self, time):
Expand Down

0 comments on commit 88b2ebc

Please sign in to comment.