Implement footstep sounds when walking

This commit is contained in:
Evan Pratten 2020-04-18 16:33:18 -04:00
parent 0c42644466
commit 0cae24deb8
No known key found for this signature in database
GPG Key ID: 93AC7B3D071356D3
3 changed files with 7 additions and 2 deletions

View File

@ -44,6 +44,9 @@ Player.prototype.update = function() {
this.rightLeg.angle += pi; this.rightLeg.angle += pi;
} }
this.shouldMoveLeg = false; this.shouldMoveLeg = false;
// Play the footstep sound
soundAssets.footstep.play();
} }
// deselect // deselect
} else { } else {

View File

@ -12,12 +12,14 @@
// A mapping of asset names to their files // A mapping of asset names to their files
// This exists to give nicer names to files // This exists to give nicer names to files
let soundAssetMap = { let soundAssetMap = {
"debug-ding":"./assets/sounds/debug-ding.mp3" "debug-ding": "./assets/sounds/debug-ding.mp3",
"footstep":"./assets/sounds/footstep.mp3"
} }
// All available sounds // All available sounds
let soundAssets = { let soundAssets = {
debug_ding: new SoundSnippet("debug-ding", audioAssetType.sfx) debug_ding: new SoundSnippet("debug-ding", audioAssetType.sfx),
footstep: new SoundSnippet("footstep", audioAssetType.sfx)
} }
/** /**

Binary file not shown.