Changing Room when object clicked?

conman06

Member
I'm trying to make the room change when an object is clicked. Note: I am new to the software. If you could explain it I would appreciate it.
 

rodrigo1434

Member
you basically need to activate that function (go to a room) whenever something happens (events)

Within the object to be clicked you can either write this inside the event of clicking with the left button (most suitable the pressed option)

GML:
room= 'name the room you want'

or you can do it within the Step event, so it is going to check every single frame if that happes manually.
event: Step

GML:
 if mouse_check_button_pressed(mb_left)
room='the room you want'
I suppose that the room already exists, if you just need to go to the next one, make sure to check if the next one really exists.

GML:
if room_exists(room_next(room))

room= room_next(room)
 
Last edited:

conman06

Member
you basically need to activate that function (go to a room) whenever something happens (events)

Within the object to be clicked you can either write this inside the event of clicking with the left button (most suitable the pressed option)

GML:
room= 'name the room you want'

or you can do it within the Step event, so it is going to check every single frame if that happes manually.
event: Step

GML:
 if mouse_button_pressed(mb_left)
room='the room you want'
I suppose that the room already exists, if you just need to go to the next one, make sure to check if the next one really exists.

GML:
if room_exists(next_room(room))

room= next_room(room)
Thank you! This helped alot.
 

rodrigo1434

Member
That is room_next() instead of next_room() I wrote first. I already corrected the mistake. Same goes to mouse_check_button_pressed. Now it is ok!
 
Top