Hi, I need save the last values for sum new values in points to show the cards in the same position the player. But i have a problem when try first time the position is correct and the same numbers of dices, but when try second time show other card because is lots the value of dice.
the number {1:0} in list represent the id of player
I try this solution but not working.
let dice;
let points = {1:0};
var x = Math.floor(Math.random() * ((6 - 1) + 1) + 1);
var y = Math.floor(Math.random() * ((6 - 1) + 1) + 1);
dice = x+y;
points = {1: dice};
console.log(points, “teste de dados”);
movePlayers(points);
updatePlayers();
createCards(points);
updateRound();
}
function createCards(points) {
let n= 0;
let c = {1:n};
backImg = loadImage(’./assets/images/back.png’);
for (let i = 0; i < deckcards.length; i++){
for (let j = 0; j < points[i]; j++){
console.log(points[i]);
for (let k = 0; k < c[i]; k++){
image(cardsImg[c[i]], 310, 130, 250,350);
//console.log(cardsImg[points[i]],“teste de casas”);
n = n + points[i];
}
}
}
}