From e20e93f27fc736e7d748b427c6acd6733f7b2c50 Mon Sep 17 00:00:00 2001 From: Trystan-Schmits Date: Thu, 2 Nov 2023 20:06:12 +0000 Subject: [PATCH] box Sounds! --- _posts/2023-10-25-Game.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/_posts/2023-10-25-Game.md b/_posts/2023-10-25-Game.md index 2e3d4f0..500af5e 100644 --- a/_posts/2023-10-25-Game.md +++ b/_posts/2023-10-25-Game.md @@ -20,13 +20,15 @@ categories: ['C4.1'] background-color:white; } + + +

-
@@ -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}; @@ -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; } @@ -570,6 +576,7 @@ window.addEventListener('keydown',function(e){ box1 = false; // Make boxObject1 disappear boxObject1.scale = [0,0]; + boxAudio.play(); showEKeySprite = false; } // Check for overlap with boxStackObject2 @@ -577,6 +584,7 @@ window.addEventListener('keydown',function(e){ box4 = false; // Make boxStackObject2 disappear boxStackObject2.scale = [0,0]; + boxAudio.play(); showEKeySprite = false; } // Check for overlap with boxStackObject1 @@ -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) {