Jigsaw Puzzle...

Hey guys.

I have this assignment at school where i have to make a Jigsaw puzzle in unity and i dont know how… My teacher told me to use arrays and drag n drop but i dont know what that is. I had no luck finding any tutorials on both. Can you please help me ?

You can use 2D arrays to program the puzzle pieces:

var multiDimensionalArray = [
    [1,2,3,4],
    [5,6,7,8],
    [9,10,11,12],
    [13,14,15,16]
    ];

Each number representing a puzzle piece, when placed in order (like above) the puzzle is complete,you can verify that with:

var correctPieces: int = 0;
var currentPos: int = 0;

for (var i : float=0; i < multiDimensionalArray[0].Length; i++) {
    for (var j : float=0; j < multiDimensionalArray.Length; j++) {
        currentPos++;
        if (multiDimensionalArray*[j]==currentPos)*

correctPieces++;
}
}
In this case you need 16 correct pieces, so when correctPieces==16 you win !
And you can scramble the puzzle randomly, manually or with code.