• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Preventing to drag multiple instances

D

Darth Raven

Guest
Hello!
I'm trying to avoid to drag multiple instances. I pretend to only move instance, and if it meets the other instance, both will return to their places.
This instances have no sprite so I can't use place_meeting. I'm trying to use the var "with":
At the object "ThisO1":
step event:

drag = (image_alpha==1)&&mouse_check_button(mb_left);
....
if drag
{
with (IsO) {drag= 0}
x = mouse_x;
y = mouse_y;
}

The object "IsO" has a similiar code for drag. I'm trying to call the variable drag from IsO, but I can move both if I drag the object " ThisO1" into "IsO".
 
M

Mishtiff

Guest
If you only want the user to be able to drag one object at a time:
create a global variable:
global.dragging = false;

Have all instances check if global.dragging.

if global.dragging is false, set it to true until the user lets go of mouse.
 
Top