good room transition

Started by stuh505, Fri 01/04/2005 20:02:48

Previous topic - Next topic

stuh505

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.

scotch

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.

DoorKnobHandle

Argh, scotch. Might post this as well...

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

Code: ags

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...

stuh505

thank you.  eternal noob out.

stuh505

#4
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

Gilbert

* Gilbot V7000a just realised there's an AGS V2.65.






Pun intended, no offence. :=

DoorKnobHandle

oh... 2.62 is what I mean... almost told you guys about that secret version me and cj have... ^^

SMF spam blocked by CleanTalk