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){