comparison mamba/engine.py @ 320:13eaea2365b3

Stop music on scene changes
author Neil Muller <drnlmuller@gmail.com>
date Fri, 16 Sep 2011 19:34:14 +0200
parents 49fe66680ff8
children 38f95fbc3710
comparison
equal deleted inserted replaced
319:d8770b73e77e 320:13eaea2365b3
1 """Game engine and top-level game loop.""" 1 """Game engine and top-level game loop."""
2 2
3 from mamba.constants import SCREEN, FPS 3 from mamba.constants import SCREEN, FPS
4 from mamba.sound import stop_sound
4 5
5 import pygame.event 6 import pygame.event
6 import pygame.display 7 import pygame.display
7 import pygame.time 8 import pygame.time
8 import pygame 9 import pygame
43 44
44 class Habitat(object): 45 class Habitat(object):
45 46
46 def __init__(self, size=SCREEN): 47 def __init__(self, size=SCREEN):
47 from mamba.widgets.base import Container 48 from mamba.widgets.base import Container
49 stop_sound() # Always stop any music on scene changes
48 self.surface_size = size 50 self.surface_size = size
49 self.surface = None 51 self.surface = None
50 self.container = Container(pygame.Rect((0, 0), self.surface_size)) 52 self.container = Container(pygame.Rect((0, 0), self.surface_size))
51 53
52 def on_enter(self): 54 def on_enter(self):