- moved sound initialization and pygame init to __init__ of TheGame

master
Steve Clement 2014-08-30 23:03:14 +02:00
parent 945e55c100
commit 5bcaf35aca
1 changed files with 11 additions and 11 deletions

22
game.py
View File

@ -16,6 +16,16 @@ class TheGame:
def __init__(self):
""" foo """
self.colors = [BLUE, GREEN, RED, YELLOW]
pygame.init()
try:
pygame.mixer.init()
pygame.mixer.music.set_volume(0.5)
noSound = False
except:
print("Y U NO sound? :(")
noSound = True
pygame.display.set_caption('Pin Avo, the Cado!')
def initialize_screen(self):
@ -61,18 +71,7 @@ class TheGame:
def main(self):
pygame.init()
try:
pygame.mixer.init()
pygame.mixer.music.set_volume(0.5)
noSound = False
except:
print("Y U NO sound? :(")
noSound = True
pygame.display.set_caption('Pin Avo, the Cado!')
clock = pygame.time.Clock()
# initialize_screen() won't work for dualscreen
#size = initialize_screen()
size = (800, 600)
@ -180,4 +179,5 @@ class TheGame:
if __name__ == '__main__':
game = TheGame()
game.playLevel()
game.main()