Update index.html
Browse files- index.html +3 -7
index.html
CHANGED
@@ -29,14 +29,13 @@
|
|
29 |
|
30 |
let currentScore = 0;
|
31 |
let level = 1;
|
32 |
-
let fallSpeed = 3; // Initial fall speed (seconds)
|
33 |
let platformX = window.innerWidth / 2 - 50;
|
34 |
platform.style.left = platformX + "px";
|
35 |
|
36 |
let remainingLives = 4;
|
37 |
let ballY = -30;
|
38 |
let ballX = Math.floor(Math.random() * (window.innerWidth - 30));
|
39 |
-
let ballSpeed =
|
40 |
let isTouching = false;
|
41 |
|
42 |
// Kontrol menggunakan Mouse
|
@@ -95,8 +94,7 @@
|
|
95 |
if (currentScore % 10 === 0) {
|
96 |
level++;
|
97 |
levelDisplay.innerHTML = "Level: " + level;
|
98 |
-
|
99 |
-
ballSpeed += 0.1; // Make ball fall faster
|
100 |
}
|
101 |
score.innerHTML = "Score: " + currentScore;
|
102 |
resetBall();
|
@@ -117,7 +115,6 @@
|
|
117 |
};
|
118 |
|
119 |
let resetBall = () => {
|
120 |
-
// Reset ball's position to top and random X position
|
121 |
ballY = -30; // Reset ball to start position
|
122 |
ballX = Math.floor(Math.random() * (window.innerWidth - 30)); // New random X position
|
123 |
ball.style.top = ballY + "px";
|
@@ -128,8 +125,7 @@
|
|
128 |
remainingLives = 4;
|
129 |
currentScore = 0;
|
130 |
level = 1;
|
131 |
-
ballSpeed =
|
132 |
-
fallSpeed = 3;
|
133 |
score.innerHTML = "Score: " + currentScore;
|
134 |
levelDisplay.innerHTML = "Level: " + level;
|
135 |
updateLives();
|
|
|
29 |
|
30 |
let currentScore = 0;
|
31 |
let level = 1;
|
|
|
32 |
let platformX = window.innerWidth / 2 - 50;
|
33 |
platform.style.left = platformX + "px";
|
34 |
|
35 |
let remainingLives = 4;
|
36 |
let ballY = -30;
|
37 |
let ballX = Math.floor(Math.random() * (window.innerWidth - 30));
|
38 |
+
let ballSpeed = 2; // Ball fall speed per frame
|
39 |
let isTouching = false;
|
40 |
|
41 |
// Kontrol menggunakan Mouse
|
|
|
94 |
if (currentScore % 10 === 0) {
|
95 |
level++;
|
96 |
levelDisplay.innerHTML = "Level: " + level;
|
97 |
+
ballSpeed += 0.2; // Increase ball speed every 10 points
|
|
|
98 |
}
|
99 |
score.innerHTML = "Score: " + currentScore;
|
100 |
resetBall();
|
|
|
115 |
};
|
116 |
|
117 |
let resetBall = () => {
|
|
|
118 |
ballY = -30; // Reset ball to start position
|
119 |
ballX = Math.floor(Math.random() * (window.innerWidth - 30)); // New random X position
|
120 |
ball.style.top = ballY + "px";
|
|
|
125 |
remainingLives = 4;
|
126 |
currentScore = 0;
|
127 |
level = 1;
|
128 |
+
ballSpeed = 2;
|
|
|
129 |
score.innerHTML = "Score: " + currentScore;
|
130 |
levelDisplay.innerHTML = "Level: " + level;
|
131 |
updateLives();
|