Calling rooms and returning back to where you left off

Started by ColtonPhillips, Fri 13/11/2009 09:07:57

Previous topic - Next topic

ColtonPhillips

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? 

Khris

  player.ChangeRoom(player.PreviousRoom);
You should read through the complete manual at least once, also please use the forum search first.

ColtonPhillips

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?

Khris

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);

ColtonPhillips

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?

Wonkyth

You can also store the direction, and then use the FaceRight module (or some easy code) to set it when you change room.
"But with a ninja on your face, you live longer!"

Matti

You can store the character.Loop and later set the character.Loop again.

TerranRich

Basically, everything about the player (and any character, object, et al) can be stored in a variable, and used later again.
Status: Trying to come up with some ideas...

RickJ

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

TerranRich

Wow, I didn't know that existed, RickJ. I could use that as well. :)
Status: Trying to come up with some ideas...

SMF spam blocked by CleanTalk