[SOLVED] Draggable object behavior question

hey! :grin:

I have a question regarding the Draggable Object behavior.
Is possible to create a fixed menu with several draggable objects where I can create infinite copies and possibly delete one of each copy individually? I attach here a little draw to explain visually:

So for example here, I drag two squares and then I want to cancel one of the two. Is this possible?

Thanks for any input and help in advance!

a long time ago i made a system simaler to it(well as far as I understand it at least) Download with some(maybe little) changes you could get what you want i think

1 Like
  • Put all your draggable objects into a group (call it Draggable) :


  • Give each dragged object 2 boolean variables - is_dragged and is_original, both defaulting to false.
  • Give each dragged object 2 value variables - original_x and original y.


In the events

  • At the beginning of the scene set the is_original to true for each draggable object in the editor scene, and the original_x and original_y to the x & y co-ordinates of the object.
  • When a Draggable is being dragged, set it’s variable is_dragged to true.
  • If mouse button is released, is_original is true and is_dragged is true, then set is_dragged to false and make a copy of the draggble :
  • If the delete key is pressed and the mouse is over a draggable obejct that has is_original = false, delete the draggable.

(note, the last 2 sub event cannot be combined. They must be separate events).

2 Likes

Thanks a lot, both! These examples solve what I was looking for :star_struck: :star_struck:

1 Like