Browse Source

Add key sounds

Thomas Dy 11 years ago
parent
commit
b837858f87
5 changed files with 14 additions and 3 deletions
  1. 13 3
      scripts/game.js
  2. 1 0
      scripts/games/safari.js
  3. BIN
      sound/back.mp3
  4. BIN
      sound/confirm.mp3
  5. BIN
      sound/pause.mp3

+ 13 - 3
scripts/game.js

@@ -57,9 +57,17 @@ var Game = {
       soundDeferred.resolve(this);
     }
   });
-  soundDeferred.promise.done(function() {
-    Game.start();
-  });
+  soundDeferred.promise
+    .then(function() {
+      return [
+        createSound('confirm', 'sound/confirm.mp3'),
+        createSound('back', 'sound/back.mp3'),
+        createSound('pause', 'sound/pause.mp3')
+      ]
+    })
+    .done(function() {
+      Game.start();
+    });
 })();
 
 function Scene() {}
@@ -95,6 +103,7 @@ var MainMenu = new Scene();
     ];
 
     Game.sceneManager.push(new SoundSafari(beats));
+    soundManager.play('confirm');
   }
   MainMenu.update = function() {};
   MainMenu.draw = function() {
@@ -125,6 +134,7 @@ var PauseScreen = new Scene();
       case 112:
       case 32:
         Game.sceneManager.pop();
+        soundManager.play('back');
     }
   };
   PauseScreen.load = PauseScreen.resume = function() {

+ 1 - 0
scripts/games/safari.js

@@ -469,6 +469,7 @@ function SoundSafari(beatInfo) {
       case 112: // p
       case 32:  // space
         Game.pause();
+        soundManager.play('pause');
         break;
       case 68:  // D
         debug = !debug;

BIN
sound/back.mp3


BIN
sound/confirm.mp3


BIN
sound/pause.mp3