- Added initial sound class

master
Steve Clement 2014-08-30 21:41:53 +02:00
parent 7260765327
commit c1f1c85d45
2 changed files with 22 additions and 0 deletions

View File

@ -80,4 +80,24 @@ class Avocado:
print('platch')
return True
def mute(self,mute=False):
if mute:
pygame.mixer.music.set_volume(0.0)
else:
pygame.mixer.music.set_volume(0.5)
def playLevel(self,lvl=1):
if lvl == 1:
pygame.mixer.music.load("""audio/level1.wav""")
elif lvl == 2:
pygame.mixer.music.load("""audio/level2.wav""")
elif lvl == 3:
pygame.mixer.music.load("""audio/level3.wav""")
pygame.mixer.music.play()
def fade(self):
pygame.mixer.music.fadeout(3000)
def loadClick(self):
self.click = pygame.mixer.Sound("audio/click.wav")
return self.click

View File

@ -21,6 +21,8 @@ def initialize_screen():
def main():
pygame.init()
pygame.mixer.init()
pygame.mixer.music.set_volume(0.5)
pygame.display.set_caption('Pin Avo, the Cado!')
clock = pygame.time.Clock()