Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: stuh505 on Fri 01/04/2005 20:02:48

Title: good room transition
Post by: stuh505 on Fri 01/04/2005 20:02:48
A lot of adventure games have room transitions where, after walking off one screen, you see them walk onto the next screen from off the screen.  this seems like a really simple problem but I'm not sure how to do it, because walkable areas do not extend off of the screen.
Title: Re: good room transition
Post by: scotch on Fri 01/04/2005 20:08:22
Walkable areas don't, but as far as I can remember, you are free to place characters off screen, and use a blocking and direct (walkable ignoring), walk command to get them onto the walkable area.
Title: Re: good room transition
Post by: DoorKnobHandle on Fri 01/04/2005 20:09:32
Argh, scotch. Might post this as well...

Draw your walkable areas as usual and use this script on room enter:


character[GetPlayerCharacter()].x = -30;
MoveCharacterDirect ( GetPlayerCharacter ( ), 10, character[GetPlayerCharacter()].y );


This is AGS 2.65 code and not tested / may need improvement...

What it does is, it repositions the player character to the left off-screen area and leaves the y position coordinate the same and then moves the player character to the onscreen area at x coordinate 10 and still leaving the y coordinate untouched...
Title: Re: good room transition
Post by: stuh505 on Fri 01/04/2005 20:17:43
thank you.  eternal noob out.
Title: Re: good room transition
Post by: stuh505 on Fri 01/04/2005 20:40:59
here's a little bit more efficient way to do it

when stepping on the area transition, teleport to the new room and place them some distance off the edge of the screen

then put this in the after-fadein for any calling room...that way you have less individual scripting to do for each transition because this will never need to change

Quoteint px = character[player.ID].x,
Ã,  Ã,  py = character[player.ID].y;
int nx = px, ny = py;Ã,  Ã,  //new coords
int edge = 10; //how far to walk from edge

if (px < 0 && py > 0 && py < game.room_height) //left side
{
Ã,  nx = edge;
} else if (px > game.room_width && py > 0 && py < game.room_height) //right side
{
Ã,  nx = game.room_width - edge;
} else if (py < 0 && px > 0 && px < game.room_width) //top
{
Ã,  ny = edge;
} else if (py > game.room_height && px > 0 && px < game.room_width) //bottom
{
Ã,  ny = game.room_height - edge;
}

character[player.ID].Walk(nx,ny, eBlock, eAnywhere);Ã, 

edit - i guess you'd actually want this to be a function in the global script
Title: Re: good room transition
Post by: Gilbert on Mon 04/04/2005 09:07:19
/me just realised there's an AGS V2.65.






Pun intended, no offence. :=
Title: Re: good room transition
Post by: DoorKnobHandle on Mon 04/04/2005 12:17:37
oh... 2.62 is what I mean... almost told you guys about that secret version me and cj have... ^^