Taking just one instance from an object

Hello guys!
I have like 30 same object in 1 room and I want to do when I click that object image_index change but when I click all of the 30 instances changing.
I want this code for just that instance.
How can I do it?
Sorry for bad English.

-----------------------------------------------------------------------

in objects create event:
image_speed = 0;
amISelected = false;


in objects step event:
if (mouse_check_button_pressed(mb_left)) {
DoBox();
}


in DoBox:
if (image_index = 0) {
image_index = 1;
}
else if (image_index = 1) {
image_index = 0;
}
amISelected = true;
 

FrostyCat

Member
You only checked if the mouse is clicked, you never checked if it was on top of the current instance.
Code:
if (mouse_check_button_pressed(mb_left) && position_meeting(mouse_x, mouse_y, id)) {
  DoBox();
}
 
Top