Merge branch 'master' of https://github.com/rsninja722/LudemDare46
This commit is contained in:
commit
0a688b98d0
@ -37,8 +37,14 @@ let soundAssets = {
|
|||||||
*/
|
*/
|
||||||
function playRandomFootstep() {
|
function playRandomFootstep() {
|
||||||
|
|
||||||
// There has to be a one-liner somewhere in the game...
|
// Build a list of footsteps
|
||||||
[soundAssets.footstep1, soundAssets.footstep2, soundAssets.footstep3, soundAssets.footstep4, soundAssets.footstep5, soundAssets.footstep6][Math.min(Math.floor(Math.random() * Object.keys(soundAssets).length - 1), Object.keys(soundAssets).length - 1)].play();
|
let step_sounds = [soundAssets.footstep1, soundAssets.footstep2, soundAssets.footstep3, soundAssets.footstep4, soundAssets.footstep5, soundAssets.footstep6];
|
||||||
|
|
||||||
|
// Choose a random footstep
|
||||||
|
let footstep_id = Math.floor(Math.random() * step_sounds.length);
|
||||||
|
|
||||||
|
// Play the sound
|
||||||
|
step_sounds[footstep_id].play();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user