How to draw a stroke by clicking and dragging with the mouse?

Hello, I’m developing a game in which I could draw a path that connects two of the objects by clicking the mouse and dragging from one object to another. Could anyone tell me how to do this?
game

Ha, that’s ironic - last night I created a similar kind of thing for the class I’m teaching.

Here’s one that will draw along with the mouse:

And this one draws from the origin (0,0) to the mouse while the mouse button is held down:

Note, this one only does one line. When you click a second time, the first line disappears.

If you want the lines on the screen permanently, then you’ll have to modify what I’ve given you.

@MrMen, thanks for the help. I managed to draw the lines between objects with the mouse. However, I’m still having difficulties to create an event that stores the connection information between the objects by the drawn lines. Do you have any idea how I can do this?

Yep. Create a new scene array variable called LinePoints, and add the following events:

You can add the structure variable _points, but if you don’t, then GDevelop will just create it for you.