So i'm doing this game, it's basically a number sliding game where the numbers are randomized and you just have to put it on order. The problem is, I want to assign an image to each number so that when the puzzle is solved it forms a whole picture, but the numbers are randomized so i don't know how to put an image to a specific number??
What kind of puzzle?
it's a number puzzle, like this; but i want to put an image to each number so it forms a picture when solved.
Let me suggest to use 16 buttons, not image sprite in canvas.
You can give each button a background image.
yes i did use buttons, but when the puzzle is initialized, each button is randomized to a different number, but i want to assign the image to a specific number... sorry if it's confusing.
Make a list of the images name, an a list of the buttons. Then loop the list to assign one image to one button.
Be careful how you randomize the list of images.
Only half of randomizations of the 15 puzzle are solvable.
See unsolvable sliding block puzzles - Google Search