Skip to content

Commit

Permalink
box Sounds!
Browse files Browse the repository at this point in the history
  • Loading branch information
Trystan-Schmits committed Nov 2, 2023
1 parent 599b49a commit e20e93f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion _posts/2023-10-25-Game.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ categories: ['C4.1']
background-color:white;
}
</style>
<audio id="audio" src="/Group/audio/2023-10-23-Menu_Theme.mp3" preload="auto"></audio>
<audio id="audio2" src="/Group/audio/box.wav" preload="auto"></audio>

<button id="start">start</button>
<canvas id="mainDisplay" class="container" height="500px" width="500px"></canvas>
<br>
<canvas id="fadeDisplay" class="container2" height="500px" width="500px"></canvas>
<br>
<canvas id="subDisplay" class="container2" height="500px" width="500px"></canvas>
<audio id="audio" src="/Group/audio/2023-10-23-Menu_Theme.mp3" preload="auto"></audio>
<br>
<canvas id="subDisplay1" class="container2" height="500px" width="500px"></canvas>
<div></div>
Expand Down Expand Up @@ -130,6 +132,9 @@ import {Display, subDisplay} from "/Group/myScripts/GameScripts/Displays.js";
var box3 = true;
var box4 = true;

//audio
var boxAudio = document.getElementById("audio2");

//text
var bedText1 = {text:"unpack the boxes",font:"14px Ariel",fillStyle:"black",posX:20,posY:30};
var bedText2 = {text:"talk to the neighbors",font:"14px Ariel",fillStyle:"black",posX:20,posY:30};
Expand Down Expand Up @@ -562,6 +567,7 @@ window.addEventListener('keydown',function(e){
if (checkForOverlap(myCharacterObject, boxObject2)&&box2==true) {
box2 = false;
// Make boxObject2 disappear
boxAudio.play();
boxObject2.scale = [0,0];
showEKeySprite = false;
}
Expand All @@ -570,13 +576,15 @@ window.addEventListener('keydown',function(e){
box1 = false;
// Make boxObject1 disappear
boxObject1.scale = [0,0];
boxAudio.play();
showEKeySprite = false;
}
// Check for overlap with boxStackObject2
if (checkForOverlap(myCharacterObject, boxStackObject2)&&box4==true) {
box4 = false;
// Make boxStackObject2 disappear
boxStackObject2.scale = [0,0];
boxAudio.play();
showEKeySprite = false;
}
// Check for overlap with boxStackObject1
Expand All @@ -585,6 +593,7 @@ window.addEventListener('keydown',function(e){
// Make boxStackObject1 disappear
boxStackObject1.scale = [0,0];
showEKeySprite = false;
boxAudio.play();
flag1 = true;
};
if (checkForOverlap(myCharacterObject, doorObject)&&switching==false&&active2==true) {
Expand Down

0 comments on commit e20e93f

Please sign in to comment.