GarGerry commited on
Commit
ac83adc
·
verified ·
1 Parent(s): e3e7821

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +23 -1
index.html CHANGED
@@ -124,4 +124,26 @@
124
  // Fungsi untuk mereset permainan
125
  function resetGame() {
126
  isCaught = false;
127
- ballPosition = { top
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  // Fungsi untuk mereset permainan
125
  function resetGame() {
126
  isCaught = false;
127
+ ballPosition = { top: 0, left: Math.random() * 90 }; // Bola muncul ulang.
128
+ }
129
+
130
+ // Fungsi untuk menampilkan overlay Game Over
131
+ function showGameOver() {
132
+ finalScoreDisplay.textContent = score; // Tampilkan skor akhir.
133
+ overlay.style.display = 'flex'; // Tampilkan overlay.
134
+ }
135
+
136
+ // Tombol restart untuk memulai ulang permainan
137
+ restartButton.addEventListener('click', () => {
138
+ overlay.style.display = 'none'; // Sembunyikan overlay.
139
+ score = 0; // Reset skor.
140
+ scoreDisplay.textContent = score;
141
+ resetGame();
142
+ moveBall();
143
+ });
144
+
145
+ // Memulai permainan
146
+ moveBall();
147
+ </script>
148
+ </body>
149
+ </html>