From 4945ed135de5c4b59b2f11b582a8ecc172d5a5ed Mon Sep 17 00:00:00 2001 From: Richard Halsall <–richard-glyn.halsall@informatik.hs-fulda.e> Date: Fri, 3 Feb 2023 18:21:02 +0100 Subject: [PATCH] =?UTF-8?q?Gameloop=20l=C3=A4uft=20bis=20zum=20Zur=C3=BCck?= =?UTF-8?q?setzen=20der=20Spielerposition=20und=20das=20Reihez=C3=A4hler?= =?UTF-8?q?=20inkrementiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- schlangen_und_leitern/js/Bridge.js | 36 +++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/schlangen_und_leitern/js/Bridge.js b/schlangen_und_leitern/js/Bridge.js index 521115a..398e402 100644 --- a/schlangen_und_leitern/js/Bridge.js +++ b/schlangen_und_leitern/js/Bridge.js @@ -34,9 +34,39 @@ function init(playerCount){ //new game } - function gameloop (boardArr, playerArray, playerCount){ - + console.log("player " + turnCount + " ist dran"); + + //würfle function aufrufen let roll = rollDice(); - + //spieler auswählen + player = playerArray[turnCount-1]; + //spieler innerer stelle auf neue stelle ändern + movePlayer(player, roll); + + + //setzen die neu Stellewert auf die zurzetige und die alter ausleren + resetNewOld(player); + ///////test area + pos = boardLocation(player.position); + + + ///// + + + console.log("player position is " + pos); + //check position // if snake/ladder + //change player location within array + // update player location on board + + //add to the turn counter + + + if(turnCount >= playerCount){ + turnCount = 1; + } + else { + turnCount ++ + } + } \ No newline at end of file