Mac OSX how do i make this (DnD)

C

commanding

Guest
how do i make a script so an object destroys it self when you click on it???

even code script would help!!!Screen Shot 2018-07-18 at 5.04.05 PM.png

and the event is when it collides with a certain object
 
Last edited by a moderator:
C

commanding

Guest
that image is my bad script

oh and the object is always at the mouse cursor
 
W

Woowoo

Guest
Try using destroy instead of using destroy at position.
In gml, that would be instance_destroy
 
W

Woowoo

Guest
The collision event only happens for one frame when one object hits another, then doesn't happen until the objects collide again. I think what you're looking for is
Code:
place_meeting(x, y, obj);
You would put where to check and what object to check for. If you want to check below, then it would look something like this:
Code:
place_meeting(x, y-10, obj);
This would check for the object called obj 10 pixels under the objects position.
If you wanted to destroy the object below if it was 10 pixels under you, then you could do this:
Code:
if(place_meeting(x, y-10, obj)){
 instance_destroy(obj);
}
and you're also checking for the left mouse button, so check that as well:

Code:
if(place_meeting(x, y-10, obj)&&mouse_check_button_pressed(mb_left)){
 instance_destroy(obj);
}
this is like saying "if obj is 10 below my y value, and the left mouse button is pressed then destroy obj."
You would have to put this in the step event for it to check every frame.
 
Top