Solitaire: Man kann jetzt gewinnen
This commit is contained in:
parent
44c7f4cf4a
commit
fe8060f22a
@ -416,6 +416,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="winModal">
|
||||
<div class="modal-content">
|
||||
<h2>Glückwunsch!</h2>
|
||||
<p>Du hast das Spiel gewonnen!</p>
|
||||
<p style="margin-top: 10px;">Dein finaler Punktestand: <span id="finalScore">0</span></p>
|
||||
<p style="margin-top: 5px;">Zeit: <span id="finalTime">0:00</span> - Züge: <span id="finalMoves">0</span></p>
|
||||
<div class="modal-buttons">
|
||||
<button onclick="newGame()">Neues Spiel</button>
|
||||
<button onclick="showHighscores()">Highscores</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Spielvariablen
|
||||
let score = 0;
|
||||
@ -994,6 +1007,20 @@
|
||||
newGame();
|
||||
}
|
||||
|
||||
function showWinModal(finalScore) {
|
||||
const modal = document.getElementById('winModal');
|
||||
document.getElementById('finalScore').textContent = finalScore;
|
||||
|
||||
const minutes = Math.floor(gameTime / 60);
|
||||
const seconds = gameTime % 60;
|
||||
document.getElementById('finalTime').textContent =
|
||||
`${minutes}:${seconds.toString().padStart(2, '0')}`;
|
||||
|
||||
document.getElementById('finalMoves').textContent = moves;
|
||||
|
||||
modal.classList.add('show');
|
||||
}
|
||||
|
||||
// Spiel initialisieren
|
||||
newGame();
|
||||
showRules(); // Zeige Spielregeln beim Start
|
||||
|
Loading…
x
Reference in New Issue
Block a user