D
danny2014
Guest
Hello,
I am developing a game where you have to drag objects around, So in a room i have multiple objects (obj_1, obj_2, obj_3) with this events :
Create Event:
execute code:
selected = false;
global.canSelect = true;
Step Event:
execute code:
if (selected) {
global.canSelect = false;
x = mouse_x;
y = mouse_y;
}
Mouse Event for Left Button:
execute code:
if (global.canSelect)
selected = true;
Mouse Event for Glob Left Released:
execute code:
selected=false;
global.canSelect = true;
I have to say, i didn't write this code, i saw it in a tutorial, the problem is when i drag obj_1 and i drop this object on top of obj_2 then when i try to drag again obj_1 it will also drag obj_2, i want to be able to drag only obj_1, any help will be appreciated.
Thank you.
I am developing a game where you have to drag objects around, So in a room i have multiple objects (obj_1, obj_2, obj_3) with this events :
Create Event:
execute code:
selected = false;
global.canSelect = true;
Step Event:
execute code:
if (selected) {
global.canSelect = false;
x = mouse_x;
y = mouse_y;
}
Mouse Event for Left Button:
execute code:
if (global.canSelect)
selected = true;
Mouse Event for Glob Left Released:
execute code:
selected=false;
global.canSelect = true;
I have to say, i didn't write this code, i saw it in a tutorial, the problem is when i drag obj_1 and i drop this object on top of obj_2 then when i try to drag again obj_1 it will also drag obj_2, i want to be able to drag only obj_1, any help will be appreciated.
Thank you.