Update index.html
Browse files- index.html +0 -8
index.html
CHANGED
@@ -14,17 +14,11 @@
|
|
14 |
<div id="level">Level: 1</div>
|
15 |
</div>
|
16 |
|
17 |
-
<!-- Adding sound effects -->
|
18 |
-
<audio id="bounce-sound" src="bounce-sound.mp3" preload="auto"></audio>
|
19 |
-
<audio id="game-over-sound" src="game-over.mp3" preload="auto"></audio>
|
20 |
-
|
21 |
<script>
|
22 |
let ball = document.getElementById("ball");
|
23 |
let platform = document.getElementById("platform");
|
24 |
let score = document.getElementById("score");
|
25 |
let levelDisplay = document.getElementById("level");
|
26 |
-
let bounceSound = document.getElementById("bounce-sound");
|
27 |
-
let gameOverSound = document.getElementById("game-over-sound");
|
28 |
|
29 |
let currentScore = 0;
|
30 |
let level = 1;
|
@@ -78,7 +72,6 @@
|
|
78 |
if (ballPosition.bottom >= platformPosition.top &&
|
79 |
ballPosition.left >= platformPosition.left &&
|
80 |
ballPosition.right <= platformPosition.right) {
|
81 |
-
bounceSound.play(); // Play bounce sound
|
82 |
currentScore++;
|
83 |
if (currentScore % 10 === 0) {
|
84 |
level++;
|
@@ -89,7 +82,6 @@
|
|
89 |
score.innerHTML = "Score: " + currentScore;
|
90 |
dropBall();
|
91 |
} else if (ballPosition.bottom >= window.innerHeight) {
|
92 |
-
gameOverSound.play(); // Play game over sound
|
93 |
currentScore = 0;
|
94 |
level = 1;
|
95 |
fallSpeed = 3; // Reset fall speed
|
|
|
14 |
<div id="level">Level: 1</div>
|
15 |
</div>
|
16 |
|
|
|
|
|
|
|
|
|
17 |
<script>
|
18 |
let ball = document.getElementById("ball");
|
19 |
let platform = document.getElementById("platform");
|
20 |
let score = document.getElementById("score");
|
21 |
let levelDisplay = document.getElementById("level");
|
|
|
|
|
22 |
|
23 |
let currentScore = 0;
|
24 |
let level = 1;
|
|
|
72 |
if (ballPosition.bottom >= platformPosition.top &&
|
73 |
ballPosition.left >= platformPosition.left &&
|
74 |
ballPosition.right <= platformPosition.right) {
|
|
|
75 |
currentScore++;
|
76 |
if (currentScore % 10 === 0) {
|
77 |
level++;
|
|
|
82 |
score.innerHTML = "Score: " + currentScore;
|
83 |
dropBall();
|
84 |
} else if (ballPosition.bottom >= window.innerHeight) {
|
|
|
85 |
currentScore = 0;
|
86 |
level = 1;
|
87 |
fallSpeed = 3; // Reset fall speed
|