I’m trying to make a wire connecting system between 2 objects but the objects are draggable. I want to be able to make a line connecting 2 objects and the line still being connected to them when one of them is moved like this
Hi,
for that you just need the shape painter-object. In the menu for the shape painter-object you have to make sure that the box ‘Clear the rendered image between each frame’ is checked, otherwise your line will not follow your objects.
Here is a quick example. You need boolean object variables which will be toggled in case you click/release the mouse button on the object that you want to connect.
This is hardcoded and you have to find a system that allows you to connect dynamically two or more objects. This will lead you into the wide and “exciting” world of object picking Object Picking [GDevelop wiki].
The implementation depends on the way you want the user to select and connect the objects.
(Edit: I just added the boolean for the mouse draw that was missing in the previous example)