hover, die, pickup sounds

This commit is contained in:
rsninja722 2020-04-20 19:49:23 -04:00
parent db84260f45
commit db2fd2d3ed
10 changed files with 16 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

View File

@ -89,7 +89,6 @@ function update() {
}
function draw() {
// If draw is being called, the user has interacted with the page at least once.
// This signal can be used to notify the audio permission handler
unlockAudioPermission();

View File

@ -69,9 +69,12 @@ Player.prototype.update = function() {
var targetPos = mousePosition();
var curLeg = this.getActiveLeg();
this.hover.active = false;
// right
if (distanceToLineSegment(this.rightLeg.x, this.rightLeg.y, this.rightLeg.x2, this.rightLeg.y2, targetPos.x, targetPos.y) < constants.player.select_range) {
if(this.hover.active === false) {
soundAssets.hover.play();
}
this.hover.active = true;
this.hover.leg = "R";
if(mousePress[0]) {
@ -81,6 +84,9 @@ Player.prototype.update = function() {
}
//left
} else if (distanceToLineSegment(this.leftLeg.x, this.leftLeg.y, this.leftLeg.x2, this.leftLeg.y2, targetPos.x, targetPos.y) < constants.player.select_range) {
if(this.hover.active === false) {
soundAssets.hover.play();
}
this.hover.active = true;
this.hover.leg = "L";
if(mousePress[0]) {
@ -88,7 +94,9 @@ Player.prototype.update = function() {
this.legSelected = "L";
this.hover.active = false;
}
}
} else {
this.hover.active = false;
}
}
// place box

View File

@ -18,6 +18,7 @@ Objective.prototype.update = function() {
for(var j=0;j<50;j++) {
Particles.push(new Particle(this.x,this.y));
}
soundAssets.pickUp.play();
this.callback();
return true;
}

View File

@ -25,6 +25,8 @@ let soundAssetMap = {
"cough": "./assets/sounds/cough.mp3",
"dead": "./assets/sounds/dead.mp3",
"click": "./assets/sounds/click.mp3",
"hover": "./assets/sounds/hover.wav",
"pickUp": "./assets/sounds/pickUp.wav",
"backingtrack": "./assets/sounds/backingtrack.wav"
}
@ -43,6 +45,8 @@ let soundAssets = {
cough: new SoundSnippet("cough", audioAssetType.sfx),
dead: new SoundSnippet("dead", audioAssetType.sfx),
click: new SoundSnippet("click", audioAssetType.sfx),
hover: new SoundSnippet("hover", audioAssetType.sfx),
pickUp: new SoundSnippet("pickUp", audioAssetType.sfx),
backingtrack: new SoundSnippet("backingtrack", audioAssetType.bgm)
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
<html>
<head>
<link rel="icon" type="image/gif" href="assets/images/tempIcon.png"/>
<title>error: title is undefined</title>
<title>Micromanaged Mike</title>
<meta charset="utf-8" />
<style>
html {