Windows Help with Rooms

T

talinroyal23

Guest
Alright, so, in my game, there is various options you can choose that take you to different rooms. One of them is called "Go Back" and I want it to take you to the last room you were in before it. I'm having trouble coding it and other videos/threads I've found, don't correlate with my problem. Any advice or help is welcome, thanks!
 

FrostyCat

Redemption Seeker
Save the current room in a global variable before changing to the other room:
Code:
global.room_back = room;
room_goto(rm_somewhere_else);
Then you can just use that global variable to go back:
Code:
room_goto(global.room_back);
 
T

talinroyal23

Guest
Save the current room in a global variable before changing to the other room:
Code:
global.room_back = room;
room_goto(rm_somewhere_else);
Then you can just use that global variable to go back:
Code:
room_goto(global.room_back);
Yes, but there will be multiple rooms where "Go Back" is an option, and I do not want it sending me to the same room. Will I have to create seperate objects for each of them?
 

FrostyCat

Redemption Seeker
Yes, but there will be multiple rooms where "Go Back" is an option, and I do not want it sending me to the same room. Will I have to create seperate objects for each of them?
You use the first piece whenever you go to a room where "Go Back" is an option (replacing rm_somewhere_else with that room), and the second piece when you select "Go Back". I don't see how you would arrive at the conclusion you did.
 
Top