MartinK12
Member
When u want to click top object and did not set depth of those objects the top object will not be clicked but actually the clicked object will be the first one placed in the room. But when you set depth each of those objects manually the object with the lowest depth will always be clicked.
I need to know is this the default behavior in GMS2, so no other solutions (except setting depth manually) for clicking top objects are necessary? Thank You
If u need more explanation I made simple project and below is a screenshot of what I’m talking about:
Same project. Top image = squares depth set automatically by GMS2 (all squares have depth = 0, why?). Bottom image = squares depth set in each object manually by me from 4 to 1.
I need to know is this the default behavior in GMS2, so no other solutions (except setting depth manually) for clicking top objects are necessary? Thank You
If u need more explanation I made simple project and below is a screenshot of what I’m talking about:
Same project. Top image = squares depth set automatically by GMS2 (all squares have depth = 0, why?). Bottom image = squares depth set in each object manually by me from 4 to 1.
for top clicked obj_click has this basic code in step event:
each colorful object has basic code in step event:
Code:
if mouse_check_button_pressed(mb_left) {
mouse_clear(mb_left);
ins_top_clicked = instance_position(mouse_x, mouse_y, all);
if (ins_top_clicked != noone) {
with (all) clicked = false;
ins_top_clicked.clicked = true;
}
else with (all) clicked = false;
}
Code:
if clicked image_index = 1; // with yellow outline
else image_index = 0; // without outline
Last edited: