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;
}
P5JS is saying that
createImage() was expecting Integer for the second parameter, received number instead.This can be solved by changinglet img = createImage(w, h);tplet img = createImage(int(w), int(h));.I'm not entirely sure if this helps, because I don't know how your puzzle works (how it's solved) so please tell me if this doesn't work and I'll investigate further.