How to delete a selected object and another?

I’m trying to make a window that can be moved by dragging the header and can be closed by clicking the “X” button. The problem is that when I have multiple windows on the screen, they all get killed when I close one.

I’ve tried using global and local variables for the window id and header, but it doesn’t seem to work correctly. I’ve also tried using the stickers extension to stick the window to the header, but I still can’t close the window without removing all the others.

Thank you in advance for your help.


Is the X button in collision with the window? You might be able to pick the window with a collision detection if it is.

if it is colliding with “window” and “header”. but how would that be

It would be something like:

When Close is clicked

If there is a collision between Window and Close
remove windows
can you give me more information please

You can try
Quit is clicked

  • Window is in collision with Quit - Delete Window

Or maybe that should be, Quit is in collision with window - delete window…

Your first event doesn’t filter the windows with a condition, and so the action is done on all of the windows.

Since you are using the Sticker extension to link the window and quit button, try adding the Quit is stuck to Window condition to the first event. I’m not 100% sure if the condition will filter the windows, or just return true/false.

Also, keep in mind that if you remove a window, you’ll need to unstick all objects that are stuck to it, remove them too. If you don’t unstick, it can lead to strange game behaviour.

You need something to “pick” the other instances. This should work. I’ve been told it’s also best to remove the Stick before deleting the objects.

Try: (the order is very important. It needs to pick one object to find the correct one stuck to it and then stuck to it)