R
RisingKane
Guest
Hey there everyone
I'm trying to make something, but it's getting really difficult. I'd like to share it with you.
I have one button object on screen, called 'obj_button'. I made a piece of code so I can drag and drop it anywhere I want, and it's working fine. But what I'm trying to achieve next, is to, as soon as I press the left mouse button on 'obj_button', create/copy an instance of 'obj_button'. My current code is cloning the button from the original and the cloned instances, but I'd like it to happen only from the original (first) button that was on screen.
I tried to make it like this:
I have created one variable called 'drag' in the create event for the 'obj_button' and initialized it as false.
I have also set 'drag' to false in the 'Left Released' event.
Do you have an idea why it's not working?
Thanks!
I'm trying to make something, but it's getting really difficult. I'd like to share it with you.
I have one button object on screen, called 'obj_button'. I made a piece of code so I can drag and drop it anywhere I want, and it's working fine. But what I'm trying to achieve next, is to, as soon as I press the left mouse button on 'obj_button', create/copy an instance of 'obj_button'. My current code is cloning the button from the original and the cloned instances, but I'd like it to happen only from the original (first) button that was on screen.
I tried to make it like this:
Code:
//This one is inside the 'Left Pressed' mouse button event for 'obj_button'
if ((mouse_x >= initial button x position && mouse_x <= final button x position) && mouse_y == button y position) {
drag = true;
instance_copy(true);
}
else {
instance_copy(false);
}
I have also set 'drag' to false in the 'Left Released' event.
Do you have an idea why it's not working?
Thanks!