Skip to content

Commit

Permalink
Added alert sounds by MaxTorps.
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanSanchez committed May 5, 2014
1 parent 7bd5f56 commit 87ef28c
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 14 deletions.
25 changes: 17 additions & 8 deletions public/javascripts/proximity.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,17 @@ function checkProximity() {
if (lastStatus !== status) {

if(lastStatus && lastStatus!='initial') {
document.getElementById('audio-'+lastStatus).pause();
document.getElementById('audio-'+lastStatus).currentTime = 0;
var player = document.getElementById('audio-'+lastStatus);
if (player) {
player.pause();
player.currentTime = 0;
}
}
if(status) {
document.getElementById('audio-'+status).play();
var player = document.getElementById('audio-'+status);
if (player) {
player.play();
}
}

var statusDiv = document.getElementById('status');
Expand All @@ -143,7 +149,7 @@ function checkProximity() {
} else if (status == 'enemy') {
statusDiv.innerHTML = '<span class="red">NEARBY<br>HOSTILE</span>';
} else if (status == 'mine') {
statusDiv.innerHTML = '<span class="alert">PROXIMITY<br>ALERT</span>';
statusDiv.innerHTML = '<span class="alert">MINEFIELD<br>NEARBY</span>';
} else if (status == 'redalert') {
statusDiv.innerHTML = '<span class="alert">RED<br>ALERT</span>';
} else if (status == 'drone') {
Expand Down Expand Up @@ -176,7 +182,7 @@ var statusInterval = window.setInterval(checkProximity,100);
iface.on('playerShipDamage', function() {
if (! (model.entities[model.playerShipID].shieldState) &&
alarmEnabled.shl) {
var player = document.getElementById('audio-'+lastStatus)
var player = document.getElementById('audio-'+lastStatus);
if (player) {
player.pause();
player.currentTime = 0;
Expand All @@ -191,7 +197,7 @@ iface.on('playerShipDamage', function() {
lastStatus = 'shields'
window.setTimeout(function(){
checkingProximity = false;
},2000);
},2500);
}
});

Expand All @@ -214,8 +220,11 @@ iface.on('playerUpdate',function(data) {

// Pause a potentially looped sound on game end
iface.on('gameOverReason',function(){
document.getElementById('audio-'+lastStatus).pause();
document.getElementById('audio-'+lastStatus).currentTime = 0;
var player = document.getElementById('audio-'+lastStatus);
if (player) {
player.pause();
player.currentTime = 0;
}
});


Expand Down
Binary file added public/voice/incoming-ordnance-2.ogg
Binary file not shown.
Binary file modified public/voice/incoming-ordnance.ogg
Binary file not shown.
Binary file added public/voice/mines-detected-2.ogg
Binary file not shown.
Binary file added public/voice/mines-detected.ogg
Binary file not shown.
Binary file added public/voice/proximity-alert-2.ogg
Binary file not shown.
Binary file modified public/voice/proximity-alert.ogg
Binary file not shown.
Binary file added public/voice/red-alert-2.ogg
Binary file not shown.
Binary file modified public/voice/red-alert.ogg
Binary file not shown.
Binary file added public/voice/shields-are-down-2.ogg
Binary file not shown.
Binary file added public/voice/shields-are-down.ogg
Binary file not shown.
File renamed without changes.
Binary file added public/voice_ivansanchez/incoming-ordnance.ogg
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file added public/voice_ivansanchez/proximity-alert.ogg
Binary file not shown.
Binary file added public/voice_ivansanchez/red-alert.ogg
Binary file not shown.
File renamed without changes.
12 changes: 6 additions & 6 deletions views/proximity.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@


</table>
<audio src='/voice/entering-nebula.ogg' preload="auto" id='audio-nebula'></audio>
<!-- <audio src='/voice/entering-nebula.ogg' preload="auto" id='audio-nebula'></audio> -->
<!-- <audio src='/voice/exiting-nebula.ogg' controls> -->
<audio src='/voice/navigational-hazard.ogg' preload="auto" id='audio-hazard'></audio>
<audio src='/voice/nearby-hostiles.ogg' preload="auto" id='audio-enemy'></audio>
<!-- <audio src='/voice/navigational-hazard.ogg' preload="auto" id='audio-hazard'></audio> -->
<audio src='/voice/proximity-alert.ogg' preload="auto" id='audio-enemy'></audio>

<audio src='/voice/incoming-ordnance.ogg' preload="auto" id='audio-drone' loop></audio>
<audio src='/voice/proximity-alert.ogg' preload="auto" id='audio-mine' loop></audio>
<audio src='/voice/shields-up.ogg' preload="auto" id='audio-shields'></audio>
<audio src='/voice/incoming-ordnance.ogg' preload="auto" id='audio-drone'></audio>
<audio src='/voice/mines-detected.ogg' preload="auto" id='audio-mine'></audio>
<audio src='/voice/shields-are-down.ogg' preload="auto" id='audio-shields'></audio>
<audio src='/voice/red-alert.ogg' preload="auto" id='audio-redalert'></audio>


Expand Down

0 comments on commit 87ef28c

Please sign in to comment.