Load sounds on weapon init
authorNeil <neil@dip.sun.ac.za>
Sat, 5 Mar 2016 20:27:04 +0000 (22:27 +0200)
committerNeil <neil@dip.sun.ac.za>
Sat, 5 Mar 2016 20:27:09 +0000 (22:27 +0200)
koperkapel/weapons.py

index 3962ecc96917cd14a3e7908af3dbe03485d40ea1..d2213f6144a4e8f9b98ebf8e0e5611807b6a8e6a 100644 (file)
@@ -1,6 +1,6 @@
 """ Tools for dealing with weapons. """
 
-from pgzero.loaders import images
+from pgzero.loaders import images, sounds
 from .actors.animsurf import AnimatedSurfActor
 from .util import safepath
 
@@ -14,7 +14,9 @@ class Weapon:
         self.damage = damage
         self.bullet_range = bullet_range
         self.can_tape = can_tape
-        self.sound = sound
+        self.sound = None
+        if sound:
+            self.sound = sounds.load(sound)
 
 
 WEAPONS = [