Version 0.2c :

- Add sound effects
This commit is contained in:
Guillaume DE LA RUE 2011-02-13 14:28:05 +01:00
parent 24ca06af50
commit 590ba65d18
14 changed files with 63 additions and 59 deletions

Binary file not shown.

BIN
audio/bg_music.ogg Executable file

Binary file not shown.

BIN
audio/big_laser.ogg Executable file

Binary file not shown.

BIN
audio/click.ogg Normal file

Binary file not shown.

BIN
audio/explode.mp3 Normal file

Binary file not shown.

BIN
audio/explode.ogg Executable file

Binary file not shown.

9
audio/mp3-ogg.sh Executable file
View file

@ -0,0 +1,9 @@
#! /bin/bash
mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader $1;
oggenc -m 256 audiodump.wav;
mv audiodump.ogg "`basename "$1" .mp3`.ogg";
rm audiodump.wav;
chmod 755 "`basename "$1" .mp3`.ogg";
#ffmpeg -i "$1" -ab $(mplayer -frames 0 -identify "$1" 2>/dev/null | grep -m 1 'ID_AUDIO_BITRATE' | cut -d '=' -f 2) "${1%.mp3}.ogg"

View file

@ -1,3 +1,11 @@
#soundmanager-debug {
/* SM2 debug container (optional, use or customize this as you like - makes in-browser debug output more useable) */
position:fixed;_position:absolute;right:1em;bottom:1em;width:50em;height:18em;overflow:auto;background:#fff;margin:1em;padding:1em;border:1px solid #999;font-family:monaco,"lucida console",verdana,tahoma,"sans serif";font-size:x-small;line-height:1.5em;opacity:0.9;filter:alpha(opacity=90);z-index: 1000;
}
/* RESET CSS */
/* GOOGLE FONT */
.orbitron {
font-family: 'Orbitron', serif;

View file

@ -68,6 +68,8 @@
</div>
</div>
<div id="soundManager" class=""></div>
<!-- The footer... -->
<footer id="credits" class="">
<strong>HTML5 Game Jam 2011</strong><br>
@ -77,6 +79,12 @@
<!-- Main JS Libs -->
<script type="text/javascript" src="js/libs/jquery-1.5.js"></script>
<script type="text/javascript" src="js/libs/require.js"></script>
<!-- Sound Library -->
<script type="text/javascript" src="js/libs/soundmanager/script/soundmanager2.js"></script>
<script type="text/javascript" src="js/sounds.load.js"></script>
<!-- Game Libs -->
<script type="text/javascript" src="js/GameClass.js"></script>
<script type="text/javascript" src="js/main.js"></script>

View file

@ -99,6 +99,11 @@ Layouts.Ennemies.createExplosion = function(object) {
var newObj = this.createObj(explosion) ;
self.els.push(newObj) ;
if ( timers.playSoundExplode ) clearTimeout(timers.playSoundExplode) ;
timers.playSoundExplode = setTimeout(function() {
soundManager.play('explode') ;
}, 1000/FPS) ;
setTimeout(function() {
newObj.deleteObj() ;
if ( ! Layouts.Player.running )

View file

@ -159,5 +159,8 @@ Layouts.Player.fire = function(obj) {
for ( var i in bullets ) {
this.els.push(bullets[i]) ;
}
// Play sound
soundManager.play('shoot') ;
}

View file

@ -105,6 +105,7 @@ jQuery(document).ready(function() {
// -- Bind Start Button
$('#start-game').click(function() {
soundManager.play('click') ;
$('#game-intro:visible').fadeOut(500, function() {
$(document).trigger('gameStart') ;
}) ;
@ -117,6 +118,7 @@ jQuery(document).ready(function() {
// -- Bind Restart Screen controls
$('#restart-game').click(function() {
soundManager.play('click') ;
$('#game-over:visible').fadeOut(500, function() {
$(document).trigger('gameReset') ;
}) ;

View file

@ -16,82 +16,51 @@
// -- when ready, preload sounds
soundManager.onready(function() {
// -- Background Music
soundManager.createSound({
id: 'music',
url: '/audio/bg_music.ogg',
autoLoad: true,
autoPlay: false,
multiShot: false,
volume: 10,
loop: true,
onload: function() {
this.play() ;
},
onfinish: function() {
this.play();
}
});
// -- Click
// -- Click
soundManager.createSound({
id: 'click',
url: '/assets/mp3/50559__broumbroum__sf3_sfx_menu_select_L.ogg',
url: '/audio/click.ogg',
autoLoad: true,
autoPlay: false,
multiShot: false,
volume: 50
});
// -- Validate
// -- Fire
soundManager.createSound({
id: 'validate',
url: '/assets/mp3/50562__broumbroum__sf3_sfx_menu_validate_L.ogg',
id: 'shoot',
url: '/audio/big_laser.ogg',
autoLoad: true,
autoPlay: false,
multiShot: false,
volume: 50
multiShot: true,
volume: 30
});
// -- Boom
// -- Explode
soundManager.createSound({
id: 'boom',
url: '/assets/mp3/boom.ogg',
id: 'explode',
url: '/audio/explode.ogg',
autoLoad: true,
autoPlay: false,
volume: 50
});
// -- Touch
soundManager.createSound({
id: 'touch',
url: '/assets/mp3/hopping.ogg',
autoLoad: true,
autoPlay: false,
volume: 50
});
// -- End
soundManager.createSound({
id: 'endGame',
url: '/assets/mp3/fall-explosion.ogg',
autoLoad: true,
autoPlay: false,
volume: 50
});
// -- Nitro
soundManager.createSound({
id: 'nitro',
url: '/assets/mp3/rocket-burn.ogg',
autoLoad: true,
autoPlay: false,
loops: 10,
volume: 50
});
// -- Mad Cow
soundManager.createSound({
id: 'cow',
url: '/assets/mp3/cow.ogg',
autoLoad: true,
autoPlay: false,
volume: 50
});
// -- Wizz
soundManager.createSound({
id: 'wizz',
url: '/assets/mp3/siren.ogg',
autoLoad: true,
autoPlay: false,
volume: 50
multiShot: true,
volume: 10
});
});