Merge pull request #1 from hexahigh/dev

added music mute button
This commit is contained in:
Boof 2022-11-28 13:10:04 +01:00 committed by GitHub
commit 740a80041b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<audio loop autoplay>
<audio id="music" loop autoplay>
<source src="sound/Mekorama Mobile Official Theme Song.mp3" type="audio/mp3">
</audio>
<title>HTML5 Tetris</title>
@ -11,8 +11,10 @@
<audio id="clearsound" src="sound/pop.ogg" preload="auto"></audio>
<canvas width='300' height='600'></canvas>
<button id="playbutton" onclick="playButtonClicked();">Play</button>
<button onclick="toggleMuted()">Mute|Unmute</button>
<script src='js/tetris.js'></script>
<script src='js/controller.js'></script>
<script src='js/render.js'></script>
<script src="js/music.js"></script>
</body>
</html>

4
Games/Tetris/js/music.js Normal file
View File

@ -0,0 +1,4 @@
function toggleMuted() {
var sound = document.getElementById('music');
sound.muted = !sound.muted;
}