CodET
Member
If clicking on the object I want to select the object. For this, I check whether the object is clicked or not, and make the selected variable the opposite of its current state (selected =! selected). And if it is selected, I outline the object in draw GUI. The moment I click on the object, selected is correct, but then it turns false, what is the reason for this?
GML:
//code(in step event):
if (held) {
selected =! selected;
}
//In create
hover = button_hover ();
msClick = mouse_click ();
held = hover && msClick;
//button_hover script:
var _mouseX = device_mouse_x_to_gui (0);
var _mouseY = device_mouse_y_to_gui (0);
return point_in_rectangle (_mouseX, _mouseY, x - (buttonWidth / 2), y - (buttonHeight / 2), x + (buttonWidth / 2), y + (buttonHeight / 2));
//mouse_click script:
return mouse_check_button_pressed (mb_left);