Add battery dying sound.
authorSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 22:41:15 +0000 (00:41 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 22:41:15 +0000 (00:41 +0200)
data/sounds/battery_dying.ogg [new file with mode: 0644]
data/sounds/sources.txt
tabakrolletjie/scenes/night.py

diff --git a/data/sounds/battery_dying.ogg b/data/sounds/battery_dying.ogg
new file mode 100644 (file)
index 0000000..e7392fe
Binary files /dev/null and b/data/sounds/battery_dying.ogg differ
index 021f532ae31356ac59bf93951c09d5d61b1c3a28..d6b80078025a0f0744bb587797259597de09f298 100644 (file)
@@ -36,6 +36,19 @@ Notes:
     Ogg generated using 'oggenc -q -1 -o beep_kind.ogg BEEPKIND.WAV'
 
 
+battery_dying.ogg
+-----------------
+
+URL:
+    http://archive.org/download/Berklee44v3/Berklee44v3.zip
+Source:
+    http://archive.org/details/Berklee44v3
+License:
+    http://creativecommons.org/licenses/by/3.0
+Notes:
+    Ogg generated using 'oggenc -q -1 -o battery_dying.ogg feedback_efx_2.wav'
+
+
 eating_chips_1.ogg
 eating_chips_2.ogg
 eating_chips_3.ogg
index 7813e32baab0ce118682dd04133a2d977d879adf..593a03f5bed6292238349ec5851da9a01a07e411 100644 (file)
@@ -14,6 +14,7 @@ from ..enemies import Boyd
 from ..events import SceneChangeEvent
 from ..utils import debug_timer, shadowed_text
 from ..loader import loader
+from ..sound import sound
 from ..transforms import Overlay
 from ..turnip import Turnip
 from ..widgets import ImageButton
@@ -31,6 +32,7 @@ class NightScene(BaseScene):
         self._obstacles = ObstacleManager(self._space, gamestate)
         self._lights = LightManager(self._space, gamestate)
         self._battery = BatteryManager(gamestate)
+        self._battery_dead = False
         self.check_battery()
         self._infobar = InfoBar("day", battery=self._battery, scene=self)
         self._countdownbar = CountDownBar("h")
@@ -175,7 +177,9 @@ class NightScene(BaseScene):
              (350, 240)))
 
     def check_battery(self):
-        if self._battery.current == 0:
+        if self._battery.current == 0 and not self._battery_dead:
+            self._battery_dead = True
+            sound.play_sound("battery_dying.ogg")
             self._lights.battery_dead()
 
     @debug_timer("night.tick")