When the player enters room 2, I want a bird to fly in and land before the player has the option to move. The bird then talks to the player, before flying off again.
Is there a way to code the movement of the bird or would it be simpler to do with a cutscene?
This could be one of the worst ways to do it.
but maybe it could inspire you
bool first_time = true;
function room_AfterFadeIn()//room 2
{
if (player.PreviousRoom == 1 && first_time)
{
StartCutscene(eSkipESCOnly);
Mouse.Mode = eModeWait; //you can change this graphic, probably with no image at all
if (!cBird.Moving) {
if (cBird.x < 100) {
// if the bird is on the left hand side of the screen,
// start it moving towards the right
cBird.Walk(400, cBird.y, eBlock, eAnywhere);
cBird.Say("Hello There");
EndCutscene();
cBird.Walk(0, cBird.y, eNoBlock, eAnywhere);
mouse.Mode = eModeWalkto;
first_time = false;
}
}
}
}
The movement of the character is working really well; thanks for the help Vincent. :smiley:
There is just one thing I need to add to the script, but am unaware of how to write it - how do I make the character leave the room? I tried using edges but didn't seem to work.
function room_LeaveBottom()
{
cBird.ChangeRoom(3, 155, 155);
}
Edges are only checked when the player character moves over them- your command would be triggered when the PLAYER leaves via the bottom edge.
A simple way is to use the Walk command with the eAnywhere parameter. Make a new walk command and set the y destination to higher than the room's height (in a 320x240 game, set y 0 260). This allows you to have the bird move OFFSCREEN (that's safe and a rather common technique).
After moving, you can call cBird.ChangeRoom(wherever).
Thanks, working perfectly now :)