From 6e9135130ffcb8f382313b856200130ddc7f374a Mon Sep 17 00:00:00 2001 From: Trystan-Schmits Date: Tue, 31 Oct 2023 19:58:19 +0000 Subject: [PATCH] audio --- _posts/2023-10-25-Game.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_posts/2023-10-25-Game.md b/_posts/2023-10-25-Game.md index 5208b20..601b627 100644 --- a/_posts/2023-10-25-Game.md +++ b/_posts/2023-10-25-Game.md @@ -223,7 +223,7 @@ function checkForOverlap(object1, object2) { var fadingFrame = 0; var fadingCtx = fadingCanvas.getContext("2d") -function Fadeframe(oldDisplay,newDisplay,ac1,ac2,func){ +function Fadeframe(oldDisplay,newDisplay,ac1,ac2,func,aud1,aud2){ console.log(func) fadingFrame = (fadingFrame+1)%(2*fps); @@ -256,6 +256,8 @@ if(fadingFrame == fps){ //change canvas, stop updating canvas1, start updating n ac1 = false; ac2 = true; func(); + if (!aud1 == null){aud1.pause()}; + if (!aud2 == null){aud2.play()}; } setTimeout(function() { if(fadingFrame == 0){