- Home /
How to scramble image pieces?
Hi. I am making a puzzle game for android and I would like the pieces of the image to be in a random place every time the players plays the level. I made the pieces, they're on the screen but how should I make them scrambled? Or shall I use empty places and load the images randomly on them? First idea sounds better for me. But I haven't really found anything about scrambling. A tutorial for jigsaw puzzles would be great too, but enough to answer my question. ^^
Answer by BobbleHead · May 04, 2013 at 02:37 PM
Well, giving you the code, would I guess be making your whole game.
What I'd do is create a grid. Create a marker/object at each grid segment/cross. Give each grid object a number, or ID. Store these in an array. Create another array for your image pieces. Then pick randomly from your array of images, and instantiate each image at a random number/ID location capped by your grid.
That's how I'd go about it anyway, as a test.
I will try, thanks. Other ideas welcome too. I will mark as an answer if I don't get more. ^^
Your answer
![](https://koobas.hobune.stream/wayback/20220613101520im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
android , path of videos ? 0 Answers
How do i acces files on mobile platforms? 0 Answers
How to change RawImage texture to another one when i press a buton for it 1 Answer
2D pixel art looks darker when I import it 1 Answer
[ANDROID]How to load images from a certain folder after a screenshot? 1 Answer