Creating dragabble, dynamically created sprites with texture from part of image and custom shape (for jigsaw puzzle)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By przemekd
:warning: Old Version Published before Godot 3 was released.

Hello, I want to create jigsaw puzzle in godot but I do not know where to start. I am super new to godot and the documentation is sparse…

What I want to achieve is to use one of prepared image and create jigsaw puzzle from it.
I would like to create elements programatically to create new elements before the game starts. How can I define the shape of that elements (are there any bezier curves in godot?)? After I would have shapes, how can i apply texture to that shapes from preloaded image? Should I use the whole image for every piece and set the position of texture on that shape every time somehow? And finally I would love to add borders and shades to that pieces of jigsaw puzzle and be able to drag them and check their position…

I realize that it is quite a lot to ask in one question but I am completely stuck with godot docs and examples… Thanks for any help!

:bust_in_silhouette: Reply From: Aquiles

Hello przemekd, I think the easiest way is to use square with alpha textures and performance improvements and work, so the game knows where it goes each piece can use an array to check if your place is right.

you do not complicate with bezier curves

Thank you for your reply Anquiles. Maybe using alpha textures is the way to go, but I would like to generate pieces randomly, with unique cut each time…

przemekd | 2016-08-16 20:08

:bust_in_silhouette: Reply From: puppetmaster-

try out Polygon2D with Polygon2D UV Editor
border can be drawn with draw_line()

enter image description here

Thanks! I’ll try that!

przemekd | 2016-08-19 14:29