Calculator Tools Calculator Tools
Create

Double Touch Sound Game

Oct 19, 2023

About this app

A fun game where you need to double touch when you hear a specific sound.

Double Touch Sound Game 🎮 Double Touch Sound Game 🎵 Press the button to play the sound, then double touch when you hear it! 🔊 Play Sound

Related apps

Put this on your site

Source

                    <html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">

<title>Double Touch Sound Game</title>
<meta name="description" content="A fun game where you need to double touch when you hear a specific sound.">
<meta name="keywords" content="game, touch, sound, fun">

<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

<script type="text/javascript">
try {
// App Javascript Goes Here. Place your entire script content inside the try block for error handling.
var touchCount = 0;
var sound = new Audio('https://example.com/sound.mp3'); // Replace with your sound URL

// This will run when the DOM is ready.
document.addEventListener("DOMContentLoaded", function() {
var playButton = document.getElementById('play-button');
playButton.addEventListener('click', function() {
sound.play();
});

document.addEventListener('touchstart', function(e) {
touchCount = e.touches.length;

if (touchCount == 2 && !sound.paused) {
alert('🎉 Good job!');
sound.pause();
}
});
});

} catch (error) {
// This will throw the error to the parent window.
throw error;
}
</script>

<style>
/* App CSS Goes Here */
body {
background: #f6f6f6;
font-family: 'Press Start 2P', cursive;
color: #333;
text-align: center;
padding-top: 50px;
}

#play-button {
cursor: pointer;
margin-top: 20px;
padding: 20px;
border: none;
background: #ff4757;
color: #fff;
font-size: 20px;
border-radius: 5px;
}

#play-button:hover {
background: #ff6348;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<!-- App HTML Goes Here -->
<h1>🎮 Double Touch Sound Game 🎵</h1>
<p>Press the button to play the sound, then double touch when you hear it!</p>
<button id="play-button">🔊 Play Sound</button>
</div>
</body>
</html>