Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: ColtonPhillips on Fri 13/11/2009 09:07:57

Title: Calling rooms and returning back to where you left off
Post by: ColtonPhillips on Fri 13/11/2009 09:07:57
First. E.g.

A game contains a minigame, where the minigame is contained within its own room for good procedure, lets say its a video game inside of a room,

so you can go to the minigame from the room easily, however is there an easy function to return where you left off exactly? 
Title: Re: Calling rooms and returning back to where you left off
Post by: Khris on Fri 13/11/2009 09:47:00
  player.ChangeRoom(player.PreviousRoom);
You should read through the complete manual at least once, also please use the forum search first.
Title: Re: Calling rooms and returning back to where you left off
Post by: ColtonPhillips on Fri 13/11/2009 09:59:31
Correct me if im wrong but doesn't that function return you to the room at the starting position which you're character is placed?
Title: Re: Calling rooms and returning back to where you left off
Post by: Khris on Fri 13/11/2009 10:06:16
Quote from: manualPreviousRoom property
(Formerly known as character[].prevroom, which is now obsolete)

readonly int Character.PreviousRoom

Gets the room number that the character was previously in. If the character is still in the room that they started in, this will be -1. Otherwise, it will be the room number of the room that they were last in.
This is a read-only property. It is set automatically by ChangeRoom.

If the player coordinates change during the minigame, you need to store the previous coordinates in two global variables, then call player.ChangeRoom(player.PreviousRoom, px, py);
Title: Re: Calling rooms and returning back to where you left off
Post by: ColtonPhillips on Fri 13/11/2009 11:28:14
Ahh, but the character wouldnt be facing the same way correct? 
Not to be picky or anything, but logically that is true right? So we must have some sort of if case when the room loads in case the previous room is the mini game room im assuming right?
Title: Re: Calling rooms and returning back to where you left off
Post by: Wonkyth on Fri 13/11/2009 12:38:58
You can also store the direction, and then use the FaceRight module (or some easy code) to set it when you change room.
Title: Re: Calling rooms and returning back to where you left off
Post by: Matti on Fri 13/11/2009 12:41:19
You can store the character.Loop and later set the character.Loop again.
Title: Re: Calling rooms and returning back to where you left off
Post by: TerranRich on Fri 13/11/2009 18:01:48
Basically, everything about the player (and any character, object, et al) can be stored in a variable, and used later again.
Title: Re: Calling rooms and returning back to where you left off
Post by: RickJ on Fri 13/11/2009 18:13:58
Are you aware of the mini-game module?  It  uses a game restore to return back to the original game and state. There is a link to it in this thread.
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=34048.msg443220#msg443220
Title: Re: Calling rooms and returning back to where you left off
Post by: TerranRich on Fri 13/11/2009 20:04:28
Wow, I didn't know that existed, RickJ. I could use that as well. :)