diff demos/shooter/scripts/scene.py @ 480:85fa5fa486a8

Added a simple sound manager. Added music to the level.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Wed, 28 Apr 2010 17:28:29 +0000
parents ab28994820dd
children 1f37adc9a685
line wrap: on
line diff
--- a/demos/shooter/scripts/scene.py	Fri Apr 23 17:17:02 2010 +0000
+++ b/demos/shooter/scripts/scene.py	Wed Apr 28 17:28:29 2010 +0000
@@ -44,11 +44,12 @@
 	spaceobjects = property(_getObjects, _setObjects)
 
 class Scene(object):
-	def __init__(self, world, engine, objectLayer):
+	def __init__(self, world, engine, objectLayer, soundmanager):
 		self._engine = engine
 		self._world = world
 		self._model = engine.getModel()
 		self._layer = objectLayer
+		self._soundmanager = soundmanager
 		self._nodes = list()
 		
 		self._player = None
@@ -174,6 +175,8 @@
 		#and finally add the player to the scene
 		self.addObjectToScene(self._player)
 		
+		self._soundmanager.playSound("music/waynesmind2.ogg")
+		
 		self.startCamera()
 		
 	def pause(self, time):
@@ -189,9 +192,11 @@
 		
 	def gameOver(self):
 		self._gameover = True
+		self._soundmanager.stopSound("music/waynesmind2.ogg")		
 		self._world.gameOver()
 		
 	def endLevel(self):
+		self._soundmanager.stopSound("music/waynesmind2.ogg")
 		self._world.endLevel()
 		
 	def queueObjectForRemoval(self, obj):