T
Tenten2016
Guest
So I'm having trouble with one of my codes. I'm trying to make the player lose an life each time the player
clicks on an object which is called object_wrong answer. When the player clicks on an wrong answer three times, he lost an total of three lives, and the game shall restart. Object_wrong_answer, step event:
clicks on an object which is called object_wrong answer. When the player clicks on an wrong answer three times, he lost an total of three lives, and the game shall restart. Object_wrong_answer, step event:
- {
- //Check if the mouse is touching the object
- var mouse_in_bounds = point_in_rectangle(mouse_x, mouse_y, bbox_left, bbox_top, bbox_right, bbox_bottom);
- //Check if the left mouse button is clicked and released
- var mouse_clicked = mouse_check_button_released(obj_wrong_answer);
- //If the left mouse button is clicked and released while touching the object
- if (mouse_in_bounds) && (mouse_clicked) {
- //Remove 1 life or restart the room if there isn't a life to remove
- if (lives > 1) lives -= 1; else room_restart();
- }
- }