#Trying to make Jigsaw puzzle

3 messages · Page 1 of 1 (latest)

turbid star
#

Hey, have been trying to make Jigsaw puzzle game and managed to do randomize the rotation angle of each of 9 pieces. Now, i have to implement onTap on each of of those pieces which will make them rotate 90 degree untill every of those 9 pieces is at angle 0.

But I'm stuck. Kindly help.

https://cdn.discordapp.com/attachments/846315867728773120/1232399242891362324/screenshot.png?ex=662950bc&is=6627ff3c&hm=78f68b7e729d4e7166ae667e5fedbdb96e92d317c237fe08d77500205dc03fc7&

this following code randomizes each of 9 pieces , and i don't know how to procedure with implementing that onTap feature to every of those pieces

https://notepad.link/g6Epx

tall moth
#

I recently went through the Tween's github and wondered we can just use it directly from a script and here I see you using that way Nice! I wish I would have done it sooner lol.

For Implementing tap, add interaction component on every tile and listen to tap events on that. Keep a 2D array of state of tiles. In your screenshot there is no empty tile available like that of a puzzle, keep one empty so that other tiles can switch to that place. On tap over a tile just check if there's empty space available adjacent to it and if it's available switch to it.

turbid star