From 5f399b200e0427f0c8517490043810f3f11c6e5d Mon Sep 17 00:00:00 2001 From: Richard Halsall <–richard-glyn.halsall@informatik.hs-fulda.e> Date: Tue, 31 Jan 2023 18:33:33 +0100 Subject: [PATCH] Spielerbauer und Spielerarraybauer erstellen und zu Bruekefunktion zugenommen --- schlangen_und_leitern/js/Bridge.js | 9 ++++++++ schlangen_und_leitern/js/playerHandling.js | 27 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 schlangen_und_leitern/js/playerHandling.js diff --git a/schlangen_und_leitern/js/Bridge.js b/schlangen_und_leitern/js/Bridge.js index 3125ccf..52ecb5e 100644 --- a/schlangen_und_leitern/js/Bridge.js +++ b/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); + diff --git a/schlangen_und_leitern/js/playerHandling.js b/schlangen_und_leitern/js/playerHandling.js new file mode 100644 index 0000000..610152b --- /dev/null +++ b/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; + +} \ No newline at end of file