Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Thu 05/10/2017 09:06:36

Title: Return room player loop
Post by: Slasher on Thu 05/10/2017 09:06:36
Hi

I have Return to Previous Room player's x y...

Now I need to Return the loop of player as it was when he left Room.

Help appreciated...

Title: Re: Return room player loop
Post by: Khris on Thu 05/10/2017 09:14:53
variable
Title: Re: Return room player loop
Post by: Matti on Thu 05/10/2017 11:24:36
Yep, just store player.Loop in room_leave..
Title: Re: Return room player loop
Post by: Crimson Wizard on Thu 05/10/2017 13:57:46
I am not sure about actual situation you have, but if you are moving character from room A to room B with ChangeRoom command and want to keep the facing direction, since AGS 3.4.0 you can also define the direction character will have in the next room as an additional parameter. Direction ID matches loop ID, so you may do:
Code (ags) Select

player.ChangeRoom(ROOM_NUMBER, player.x, player.y, player.Loop);


If it is something else you are doing, then storing parameters in room_Leave, as others suggested above.

If you need this for multiple rooms, instead of implementing room_Leave functions in every room you could write global on_event function:
Code (ags) Select

function on_event (EventType event, int data)
{
    if (event == eEventLeaveRoom)
    {
        // Save necessary parameters here
    }
}