Mercurial > fife-parpg
comparison 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 |
comparison
equal
deleted
inserted
replaced
479:ab28994820dd | 480:85fa5fa486a8 |
---|---|
42 self._spaceobjects = spaceobjects | 42 self._spaceobjects = spaceobjects |
43 | 43 |
44 spaceobjects = property(_getObjects, _setObjects) | 44 spaceobjects = property(_getObjects, _setObjects) |
45 | 45 |
46 class Scene(object): | 46 class Scene(object): |
47 def __init__(self, world, engine, objectLayer): | 47 def __init__(self, world, engine, objectLayer, soundmanager): |
48 self._engine = engine | 48 self._engine = engine |
49 self._world = world | 49 self._world = world |
50 self._model = engine.getModel() | 50 self._model = engine.getModel() |
51 self._layer = objectLayer | 51 self._layer = objectLayer |
52 self._soundmanager = soundmanager | |
52 self._nodes = list() | 53 self._nodes = list() |
53 | 54 |
54 self._player = None | 55 self._player = None |
55 self._objectstodelete = list() | 56 self._objectstodelete = list() |
56 | 57 |
172 self._nodes[nodeindex].spaceobjects.append(powerup) | 173 self._nodes[nodeindex].spaceobjects.append(powerup) |
173 | 174 |
174 #and finally add the player to the scene | 175 #and finally add the player to the scene |
175 self.addObjectToScene(self._player) | 176 self.addObjectToScene(self._player) |
176 | 177 |
178 self._soundmanager.playSound("music/waynesmind2.ogg") | |
179 | |
177 self.startCamera() | 180 self.startCamera() |
178 | 181 |
179 def pause(self, time): | 182 def pause(self, time): |
180 self._pausedtime = time | 183 self._pausedtime = time |
181 self._paused = True | 184 self._paused = True |
187 def playerHit(self, damage): | 190 def playerHit(self, damage): |
188 self._player.applyHit(damage) | 191 self._player.applyHit(damage) |
189 | 192 |
190 def gameOver(self): | 193 def gameOver(self): |
191 self._gameover = True | 194 self._gameover = True |
195 self._soundmanager.stopSound("music/waynesmind2.ogg") | |
192 self._world.gameOver() | 196 self._world.gameOver() |
193 | 197 |
194 def endLevel(self): | 198 def endLevel(self): |
199 self._soundmanager.stopSound("music/waynesmind2.ogg") | |
195 self._world.endLevel() | 200 self._world.endLevel() |
196 | 201 |
197 def queueObjectForRemoval(self, obj): | 202 def queueObjectForRemoval(self, obj): |
198 self._objectstodelete.append(obj) | 203 self._objectstodelete.append(obj) |
199 | 204 |