Hi there,
Thanks for the help received for Scrambler.
I have an infant class learning the days of the week.
This is the correct order:
Is it possible for the sake of keeping the puzzle simple, to have only 2 days moveable and the others locked in their correct position? I would need to randomise the 2 days each time.
I will upload the code to see where I am up to at the moment.
It may have something to do with the "key" parameter but I am not sure.
const pic = new Pic("DaysOfTheWeek.png");
const tick = zimify(this.tick);
tick.vis(false);
const replay = zimify(this.replay);
let puzzle;
replay.addEventListener("click", reset.bind(this));
function reset() {
if (puzzle) {
disposePuzzle();
}
tick.vis(false);
stage.update();
// Load the assets for the new puzzle
F.loadAssets("DaysOfTheWeek.png", "pics/");
// Ensure previous event listeners are removed
F.off("complete", onAssetsLoaded);
F.on("complete", onAssetsLoaded);
}
function onAssetsLoaded() {
if (puzzle) {
disposePuzzle();
}
const pic = new Pic("DaysOfTheWeek.png");
puzzle = new Scrambler(chop((pic), 5, 1))
.sca(.6)
.center();
puzzle.on("complete", onPuzzleComplete);
//alert("New puzzle loaded");
}
function onPuzzleComplete() {
tick.vis(true);
puzzle.off("complete", onPuzzleComplete);
//alert("Puzzle completed");
}
function disposePuzzle() {
if (typeof puzzle.dispose === "function") {
puzzle.dispose();
}
if (puzzle.parent) {
puzzle.parent.removeChild(puzzle);
}
stage.removeChild(puzzle);
puzzle = null;
}