I need help moving independent objects

How do I…

I am having trouble with my game in GDevelop. I am trying to move a window object and its corresponding header object together when I click and drag the header, but it is not working as expected. The issue is that multiple windows with their respective headers are being created, but only the first window is able to be moved while the rest of the windows do not move when I drag their headers. I want to verify if the header and window have the same ID and only those with matching IDs can be moved together. How can I achieve this?

What is the expected result

When I click and drag the header object, the corresponding window object should move with it, as long as the header and window have matching IDs.

What is the actual result

Only the first window that is created is able to be moved when I click and drag its header object. The rest of the windows do not move even when their headers are clicked and dragged.

Related screenshots

Please find attached a screenshot of the relevant events for the window and header objects, which includes the conditions and actions.

Did you try the first event without a trigger once? Actually how are you dragging it, with the behavior?

Yes, I am using the behavior. And if I try without it, it blinks once, I think it’s because it selects an object at random.
I remove it and only the first object created moves

Personally I would use the sticker extension, and stick the window to the header. Make sure you only have the drag behaviour on the header, not the window. Then when you drag the header, the window will move with it without you having to do anything. No need to fuss with IDs or placing one object based on another object.

Install the Sticker extension, and when you create the window and header, use the use Stick window to header (not the other way round).

1 Like

thanks it works :slight_smile:)

1 Like