Jump to content


Photo

How do you go to the last room in the same place


  • Please log in to reply
1 reply to this topic

#1 devink9622

devink9622

    GMC Member

  • GMC Member
  • 92 posts

Posted 17 April 2011 - 09:32 PM

Is there anyway to go to one room and leave and go to the same place in the first room
example
when you get far in a room and press enter and go to a new room for the pause menu, and when you're done in the pause menu and exit that room you go back to the original room at the same position
  • 0

#2 Katuko

Katuko

    GMC Member

  • GMC Member
  • 5690 posts

Posted 17 April 2011 - 09:41 PM

Is there anyway to go to one room and leave and go to the same place in the first room
example
when you get far in a room and press enter and go to a new room for the pause menu, and when you're done in the pause menu and exit that room you go back to the original room at the same position

The simplest way is to make the room persistent (meaning all changes done to it stays even if you leave and come back), and then simply use a variable to keep track of which room you were in.

Example:
Player calls this code when going to the pause menu:
global.room_wasperisstent = room_persistent;
room_persistent = true;
global.room_playing = room;
room_goto(rm_pausemenu);

Making the variables global ensure that they don't vanish with the object when the room changes. The first variable remembers whether or not the room was persistent in the first place, meaning that the pause menu won't screw up a room you otherwise want to be non-persistent.

Then, when you want to go back from the pause menu:
room_goto(global.room_playing);
room_persistent = global.room_waspersistent;

That should work. :)

Edited by Katuko, 17 April 2011 - 09:42 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users