changeset 570:9c3528c2cbe5 pyntnclick

Bug fixes for sound hook-up.
author Simon Cross <hodgestar+bzr@gmail.com>
date Sat, 11 Feb 2012 15:48:06 +0200
parents 0587f11ff435
children 20e296d4a3a5
files gamelib/scenes/mess.py pyntnclick/main.py pyntnclick/sound.py
diffstat 3 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/scenes/mess.py	Sat Feb 11 15:40:40 2012 +0200
+++ b/gamelib/scenes/mess.py	Sat Feb 11 15:48:06 2012 +0200
@@ -258,14 +258,11 @@
 
     HISS = 'boomslang.ogg'
 
-    def __init__(self, state):
-        super(Boomslang, self).__init__(state)
-        self.hiss = self.sound.get_sound(self.HISS)
-
     def is_interactive(self, tool=None):
         return False
 
     def animate(self):
+        hiss = self.state.sound.get_sound(self.HISS)
         if self.get_data('anim_pos') > -1:
             self.current_interact.animate()
             if self.get_data('anim_pos') > self.current_interact._anim_pos:
@@ -277,7 +274,7 @@
         if randint(0, 30 * constants.FRAME_RATE) == 0:
             self.set_interact('snake')
             self.set_data('anim_pos', 0)
-            self.hiss.play()
+            hiss.play()
         return False
 
 
--- a/pyntnclick/main.py	Sat Feb 11 15:40:40 2012 +0200
+++ b/pyntnclick/main.py	Sat Feb 11 15:48:06 2012 +0200
@@ -23,7 +23,7 @@
     SCREEN, FRAME_RATE, DEBUG)
 from pyntnclick.resources import Resources
 from pyntnclick.sound import Sound
-from pyntnclick import state, data
+from pyntnclick import state
 
 
 class MainShell(Shell):
@@ -101,7 +101,8 @@
             self._debug_rects = opts.rects
         display = pygame.display.set_mode(SCREEN, SWSURFACE)
         pygame.display.set_icon(pygame.image.load(
-            data.filepath('icons/suspended_sentence24x24.png')))
+            self.resource.get_resource_path('icons/suspended_sentence24x24'
+                                            '.png')))
         pygame.display.set_caption("Suspended Sentence")
         shell = MainShell(display, self.initial_state)
         try:
--- a/pyntnclick/sound.py	Sat Feb 11 15:40:40 2012 +0200
+++ b/pyntnclick/sound.py	Sat Feb 11 15:48:06 2012 +0200
@@ -96,7 +96,7 @@
         if sound is None:
             try:
                 sound = pygame_Sound(path)
-            except pygame.error, e:
+            except pygame.error:
                 print "Sound file not found: %s" % soundfile
                 sound = DummySound()
             self.sound_cache[path] = sound
@@ -106,7 +106,7 @@
         return albow.music.PlayList(pieces, random, repeat)
 
     def get_music(self, name, prefix):
-        return albow.music.get_music(name, prefix)
+        return albow.music.get_music(name, prefix=prefix)
 
     def change_playlist(self, new_playlist):
         albow.music.change_playlist(new_playlist)