|
@ -34,9 +34,39 @@ function init(playerCount){ |
|
|
//new game
|
|
|
//new game
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function gameloop (boardArr, playerArray, playerCount){ |
|
|
function gameloop (boardArr, playerArray, playerCount){ |
|
|
|
|
|
|
|
|
|
|
|
console.log("player " + turnCount + " ist dran"); |
|
|
|
|
|
|
|
|
|
|
|
//würfle function aufrufen
|
|
|
let roll = rollDice(); |
|
|
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 ++ |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |