I make a slide puzzle game. When the puzzle is solved "won" should be displayed and the timer should stop.
I hope you can help me. Thanks.
Here is a link to the web editor for my puzzle link
Here is the part of the code but it doesn´t work:
function draw() {
if (isSolved()) {
console.log('SOLVED');
timerValue = 0;
text('Won', width/2, height/2);
}
}
function isSolved() {
for (let i = 0; i < plate.length - 1; i++) {
if (plate[i] !== tiles[i].index) {
return false;
}
}
return true;
}