Hi!
On Room3 character lies in a cryocapsule in form of sofa (cryosofa) after some puzzles, launching a cutscene of a rocket's flight in space.
function hCryosofa_Interact()
{
cPugovkin.Walk (110, 107, eBlock, eWalkableAreas);
if(Room4_passwordValue == Room4_passwordMasterValue) //game check player's input of special code on control panel. If code was correct - game allow player to lay down in cryocapsule
{
if (Room4_oGearValue == true) {
cPugovkin.FaceDirection (eDirectionDown); }
{
if (Game.IsAudioPlaying (eAudioTypeMusic) == true) {
aCCCPRadioMusic.Stop ();
}
cPugovkin.Say ("One little nap across the space...");
cPugovkin.Say ("Let's go!");
cPugovkin.y = -1; //hero go off-screen
oSofaAnim.Visible = true; //empty sofa appears on the top of background empty sofa
aBedSquek.Play ();
oSofaAnim.SetView (23);
oSofaAnim.Animate (0, 6, eOnce, eBlock, eForwards); //hero lay down into cryocapsule animation
oSofaAnim.SetView (22);
aSofaClose.Play ();
a02_Engine_startCut.Play (eAudioPriorityHigh, eOnce);
oSofaAnim.Animate (0, 5, eOnce, eBlock, eForwards); //cryocapsule closing glass door and character fall asleep
Wait (50);
cPugovkin.Transparency = 100;
cPugovkin.ChangeRoom (5, 500, 500);
oSofaAnim.Visible = false;
The rocket flight is Room6.
unction room_FirstLoad()
{
oRocketSmall.SetView (25, 0);
oRocketSmall.Animate (0, 5, eRepeat, eNoBlock, eForwards);
oRocketSmall.Move (110, 249, 4, eBlock, eAnywhere);
oRocketSmall.Move (110, -10, 4, eBlock, eAnywhere);
Wait (140);
oLogo.Visible = true; //game logo
Wait (80);
oEpisode.Visible = true; //game logo
Wait (80);
oUndername.Visible = true; //game logo
Wait (80);
cPugovkin.ChangeRoom (3, 110, 107, eDirectionDown);
}
What's the problem: I need to return player on Room3 (room with capsule), but made cryocapsule open (with animate view 23 and 22 eBackwards, of course). How to code a change of room function with followed animation of opening the capsule and getting up?
I tried make clone-room, but different player can do different stuff on this room and because of this I need to use Room3 twice.
Maybe I can make after Room6 (space fly) somehow fade out and bind this to function room_AfterFadeIn() on Room3 (room with capsule)?
Hi Litch, I'm not well versed in this coding stuff.
But personally (and for that reason) I would avoid going to another room for the rocket animation.
Instead what I would do would be to have the fullscreen animation pre-rendered, "load it into the game as an object", make it visible, animate it (all frames) and make it invisible at the end. This way, you should never leave the room and you could continue with the code without any problems (since it's practically a cutscene).
I don't know what you think about this solution...
Otherwise, I guess using a boolean variable that is activated at the end of the rocket and starts up a small animation when you enter the room (and turns off again after that) should work.
I don't know if you understood what I said, but at least I tried hahaha.
The common solution is to save a cutscene state in some global variable, and then check that variable upon loading a room, perform a part of the cutscene, advance the cutscene state var, go back and check it there again.
Basically, if you have rooms where you are supposed to play cutscenes at some point, have a cutscene state check in room_load and/or room_afterfadein, and proceed accordingly.
Duplicate rooms actually may work too, depends on how complicated all this cutscene stuff is.
Note, you may in theory "insta-jump" from a duplicate room back to normal room by setting transition to Instant (see SetScreenTransition and SetNextScreenTransition).
Also note there's player.PreviousRoom (https://www.adventuregamestudio.co.uk/manual/ags46.htm#Character.PreviousRoom) which you can use like this:
function room_AfterFadein() {
if (player.PreviousRoom == 6) {
// room was entered again after room 6 cutscene
}
else {
// room was entered regularly
}
}
Thank you all!
Pre-rendered is little bit overkill imo, but global variables is nice method.
I tried Khris solution (because it looks like most easy of three) and it's work like a charm!
But for the future I will remember the advice of Crimson Wizard and Chomba.
Thanks again. ;-D