• 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!

Taking just one instance from an object

A

Altug Yasar

Guest
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

Redemption Seeker
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