giseldo commited on
Commit
b7c7602
·
verified ·
1 Parent(s): 5899fe1

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +25 -16
index.html CHANGED
@@ -496,7 +496,7 @@
496
  <div id="powerup-list"></div>
497
  </div>
498
  <div id="level-notification">
499
- <h2>Planeta <span id="levelNumber">1</span> Completo!</h2>
500
  </div>
501
 
502
  <!-- Elementos de áudio para efeitos sonoros -->
@@ -1045,10 +1045,8 @@
1045
 
1046
  function showLevelNotification() {
1047
  const levelNotification = document.getElementById('level-notification');
1048
- document.getElementById('levelNumber').textContent = level - 1;
1049
  if (level <= powerUpDescriptions.length) {
1050
- const newPowerUp = powerUpDescriptions[level - 2] || 'Desconhecido';
1051
- document.getElementById('newPowerUp').textContent = newPowerUp;
1052
  levelNotification.style.display = 'block';
1053
  setTimeout(() => {
1054
  levelNotification.style.display = 'none';
@@ -1093,8 +1091,18 @@
1093
  updateUI();
1094
  }
1095
 
 
 
 
 
 
 
 
 
 
1096
  function nextLevel() {
1097
  showLevelNotification();
 
1098
  level++;
1099
  hiPlanet = Math.max(hiPlanet, level);
1100
 
@@ -1112,14 +1120,20 @@
1112
  updateUI();
1113
  }
1114
 
 
 
 
 
 
 
 
 
 
 
 
 
1115
  function endGame() {
1116
- // Reproduzir o som de Game Over
1117
- document.getElementById('game-over-sound').currentTime = 0;
1118
- document.getElementById('game-over-sound').play();
1119
-
1120
- // Parar a música de fundo
1121
- stopBackgroundMusic();
1122
-
1123
  deaths++;
1124
  gameOver = true;
1125
  if (player) {
@@ -1272,11 +1286,6 @@
1272
  } else if (e.code === 'KeyP') {
1273
  isPaused = !isPaused;
1274
  document.getElementById('pausedScreen').style.display = isPaused ? 'block' : 'none';
1275
- if (isPaused) {
1276
- stopBackgroundMusic();
1277
- } else {
1278
- startBackgroundMusic();
1279
- }
1280
  }
1281
  });
1282
  document.addEventListener('keyup', e => {
 
496
  <div id="powerup-list"></div>
497
  </div>
498
  <div id="level-notification">
499
+ <h2>Planeta Completo!</h2>
500
  </div>
501
 
502
  <!-- Elementos de áudio para efeitos sonoros -->
 
1045
 
1046
  function showLevelNotification() {
1047
  const levelNotification = document.getElementById('level-notification');
1048
+
1049
  if (level <= powerUpDescriptions.length) {
 
 
1050
  levelNotification.style.display = 'block';
1051
  setTimeout(() => {
1052
  levelNotification.style.display = 'none';
 
1091
  updateUI();
1092
  }
1093
 
1094
+ function playLevelCompleteSound() {
1095
+ const levelCompleteSound = document.getElementById('level-complete-sound');
1096
+ if (levelCompleteSound) {
1097
+ levelCompleteSound.currentTime = 0;
1098
+ levelCompleteSound.play().catch(e => console.log("Erro ao reproduzir som de nível completo:", e));
1099
+ }
1100
+ }
1101
+
1102
+ // Adicionar chamada ao som no final do nível
1103
  function nextLevel() {
1104
  showLevelNotification();
1105
+ playLevelCompleteSound(); // Reproduzir som de nível completo
1106
  level++;
1107
  hiPlanet = Math.max(hiPlanet, level);
1108
 
 
1120
  updateUI();
1121
  }
1122
 
1123
+ // Certifique-se de que o som de game over seja carregado corretamente
1124
+ const gameOverSound = document.getElementById('game-over-sound');
1125
+ gameOverSound.volume = 0.5; // Ajustar o volume para garantir que seja audível
1126
+
1127
+ function playGameOverSound() {
1128
+ if (gameOverSound) {
1129
+ gameOverSound.currentTime = 0; // Reinicia o som
1130
+ gameOverSound.play().catch(e => console.error("Erro ao reproduzir o som de game over:", e));
1131
+ }
1132
+ }
1133
+
1134
+ // Substituir a chamada existente no método endGame
1135
  function endGame() {
1136
+ playGameOverSound(); // Reproduzir o som de Game Over
 
 
 
 
 
 
1137
  deaths++;
1138
  gameOver = true;
1139
  if (player) {
 
1286
  } else if (e.code === 'KeyP') {
1287
  isPaused = !isPaused;
1288
  document.getElementById('pausedScreen').style.display = isPaused ? 'block' : 'none';
 
 
 
 
 
1289
  }
1290
  });
1291
  document.addEventListener('keyup', e => {