Browse Source

Refactoring: Funktion zum Ein- und Ausblenden von HTML-Elementen hinzugefügt und wo nötig eingesetzt

main
Richard Halsall 2 years ago
parent
commit
a5c54a54fc
  1. 28
      schlangen_und_leitern/js/makeBoard.js
  2. 6
      schlangen_und_leitern/js/playerHandling.js

28
schlangen_und_leitern/js/makeBoard.js

@ -261,9 +261,9 @@ function checkPosition(player, objectArr){
//win condition
if(player.newPosition == 100){
player.won = true;
document.getElementById("continue").style.display = "block"
document.getElementById("replay").style.display = "block"
document.getElementById("würfelBereich").style.display = "none"
changeElement("continue", "block")
changeElement("replay", "block")
changeElement("würfelBereich", "none")
}
//snake condition
@ -279,26 +279,28 @@ function checkPosition(player, objectArr){
function continueGame (){
document.getElementById("continue").style.display = "none"
document.getElementById("replay").style.display = "none"
document.getElementById("würfelBereich").style.display = "grid"
changeElement("continue", "none")
changeElement("replay", "none")
changeElement("würfelBereich", "grid")
}
function hideStartMenu(){
//playerselect versctecken
document.getElementById("2Player").style.display = "none";
document.getElementById("3Player").style.display = "none";
document.getElementById("4Player").style.display = "none";
document.getElementById("isUp").style.display = "block";
changeElement("2Player", "none")
changeElement("3Player", "none")
changeElement("4Player", "none")
changeElement("isUp", "block")
// Wufelbereich zeigen.
document.getElementById("würfelBereich").style.display = "grid";
changeElement("würfelBereich", "grid")
}
function changeElement(id, style){
document.getElementById(id).style.display = style;
}

6
schlangen_und_leitern/js/playerHandling.js

@ -194,9 +194,9 @@ function checkPosition(player, objectArr){
//win condition
if(player.newPosition == 100){
player.won = true;
document.getElementById("continue").style.display = "block"
document.getElementById("replay").style.display = "block"
document.getElementById("würfelBereich").style.display = "none"
changeElement("continue","block")
changeElement("replay","block")
changeElement("würfelBereich","none")
}
//snake condition

Loading…
Cancel
Save