diff gamelib/gamescreen.py @ 107:5213b45fcc7e

Initial event sound support
author Neil Muller <neil@dip.sun.ac.za>
date Tue, 24 Aug 2010 14:07:07 +0200
parents da547e148532
children ab11689aec36
line wrap: on
line diff
--- a/gamelib/gamescreen.py	Tue Aug 24 13:53:49 2010 +0200
+++ b/gamelib/gamescreen.py	Tue Aug 24 14:07:07 2010 +0200
@@ -86,11 +86,14 @@
 
     def mouse_down(self, event):
         result = self.state.interact(event.pos)
-        if result and result.message:
-            # Display the message as a modal dialog
-            MessageDialog(result.message, 60).present()
-            # queue a redraw to show updated state
-            self.invalidate()
+        if result:
+            if result.sound:
+                result.sound.play()
+            if result.message:
+                # Display the message as a modal dialog
+                MessageDialog(result.message, 60).present()
+                # queue a redraw to show updated state
+                self.invalidate()
 
     def animate(self):
         if self.state.animate():