Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: PsychicHeart on Wed 17/01/2007 21:05:41

Title: Random Room?
Post by: PsychicHeart on Wed 17/01/2007 21:05:41
Is there any way to go to a 'random' room with AGS?
Cheers,
Fluke.
Title: Re: Random Room?
Post by: Alynn on Wed 17/01/2007 21:27:14
I don't see why

player.ChangeRoom(Random(5) + 1); //Changes room to a random room between 1 and 6


wouldn't work.

However if you want it to go to specific X Y coords then you will have to do something like


int rndRoom = Random(5) + 1;
int playX;
int playY;

if (rndRoom == 1) {
    playX = newXValue;
    playY = newYValue;
}
else if

..........

}

player.ChangeRoom(rndRoom, playX, playY);
Title: Re: Random Room?
Post by: PsychicHeart on Wed 17/01/2007 21:28:48
Thanks, I'll Try That.