Browse Source

Spielerbauer und Spielerarraybauer erstellen und zu Bruekefunktion zugenommen

main
Richard Halsall 2 years ago
parent
commit
5f399b200e
  1. 9
      schlangen_und_leitern/js/Bridge.js
  2. 27
      schlangen_und_leitern/js/playerHandling.js

9
schlangen_und_leitern/js/Bridge.js

@ -10,8 +10,17 @@ function mainGame(playerCount){
// Wufelbereich zeigen.
document.getElementById("würfelBereich").style.display = "grid";
// build/show board + get board array
boarArr = buildBoard();
drawBoard(boarArr);
let playerArray = buildPlayerArray(playerCount);
let rollresult = rollDice();
console.log("roll result =" + rollresult);

27
schlangen_und_leitern/js/playerHandling.js

@ -0,0 +1,27 @@
function PlayerBuilder(id, boardArr){
this.id = id;
this.location = boardArr;
console.log("player" + id + "built");
}
function buildPlayerArray(playerCount, boardArr){
let playerArray = [];
for(let i = 1; i <= playerCount; i++){
let player = new PlayerBuilder(i);
playerArray.push(player)
console.log("player added to array!")
}
return playerArray;
}
Loading…
Cancel
Save