Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevineduardof committed Feb 5, 2024
0 parents commit 17d44fa
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
Binary file added audio/bip.mp3
Binary file not shown.
Binary file added audio/bombDefused.mp3
Binary file not shown.
Binary file added audio/hq-explosion-6288.mp3
Binary file not shown.
Binary file added img/aceso.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/apagado.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/explodiu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
color: #333;
}

#container {
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

#expButton {
margin-bottom: 20px;
border-radius: 30px;
overflow: hidden;
transition: transform 0.2s ease-in-out;
background-color: #d9534f;
border: none;
cursor: pointer;
}

#expButton:hover {
transform: scale(1.05);
}

#bomb {
width: 150px;
height: auto;
display: block;
}

#container p {
font-weight: bold;
font-size: 24px;
margin-bottom: 10px;
}

h3 {
text-align: center;
margin-top: 20px;
color: #666;
}

</style>
<title>Bomb Timer</title>
</head>
<body>
<div id="container">
<button id="expButton">
<img src="img/aceso.jpg" id="bomb" alt="Bomb">
</button>
<p id="timer">Time Left: 60</p>
</div>

<h3>REFERENCING COUNTER STRIKE :)</h3>

<script>
const bomb = document.getElementById("expButton");
const bombImg = document.getElementById("bomb");
const timerString = document.getElementById("timer");

const bip = new Audio("./audio/bip.mp3");
const defused = new Audio("./audio/bombDefused.mp3");
const boom = new Audio("./audio/hq-explosion-6288.mp3");

let timer = 2;
const explosionHappen = setTimeout(() => {
bomb.src = "img/explodiu.png";
}, 60000);

const timerBomb = setInterval(() => {
timer--;

timerString.innerText = `Time Left: ${timer}`;

bip.play();

if (timer === 0) {
clearInterval(timerBomb);
timerString.innerText = "BOOM!";
bombImg.src = "img/explodiu.png";
bomb.removeEventListener("click", bombWasDefuse);
boom.play();
}
}, 1000);

bomb.addEventListener("click", bombWasDefuse);

function bombWasDefuse() {
clearTimeout(explosionHappen);
clearInterval(timerBomb);

bombImg.src = "img/apagado.png";
timerString.innerText = "Bomb has been defused";
defused.play();

bip.pause();

bomb.removeEventListener("click", bombWasDefuse);
};
</script>
</body>
</html>

0 comments on commit 17d44fa

Please sign in to comment.