Skip to content

Commit

Permalink
add outline of world sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
orsi committed May 29, 2020
1 parent 9ae1ac0 commit 1f8dbc1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
Binary file added audio/footsteps-1.wav
Binary file not shown.
Binary file added audio/footsteps-2.wav
Binary file not shown.
Binary file added audio/footsteps-3.wav
Binary file not shown.
Binary file added audio/world.wav
Binary file not shown.
19 changes: 19 additions & 0 deletions script/world.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
var World = {

currentMusic: 0,
MUSIC: {
0: '/audio/world.wav'
},
SOUNDS: {
'footsteps-1': '/audio/footsteps-1.wav',
'footsteps-2': '/audio/footsteps-2.wav',
'footsteps-3': '/audio/footsteps-3.wav',
},
RADIUS: 30,
VILLAGE_POS: [30, 30],
TILE: {
Expand Down Expand Up @@ -347,6 +356,11 @@ var World = {
World.lightMap(World.curPos[0], World.curPos[1], World.state.mask);
World.drawMap();
World.doSpace();

// play random footstep
var randomFootstep = Math.floor(Math.random() * 2) + 1;
AudioEngine.playSound(World.SOUNDS['footsteps-' + randomFootstep]);

if(World.checkDanger()) {
if(World.danger) {
Notifications.notify(World, _('dangerous to be this far from the village without proper protection'));
Expand Down Expand Up @@ -1006,6 +1020,7 @@ var World = {
World.curPos = World.copyPos(World.VILLAGE_POS);
World.drawMap();
World.setTitle();
World.setMusic();
World.dead = false;
$('div#bagspace-world > div').empty();
World.updateSupplies();
Expand All @@ -1022,5 +1037,9 @@ var World = {

handleStateUpdates: function(e){

},

setMusic: function () {
AudioEngine.changeMusic(World.MUSIC[0]);
}
};

0 comments on commit 1f8dbc1

Please sign in to comment.