player enters room, walks somewhere and then say something

Started by Bryan_abos, Thu 07/09/2017 17:40:19

Previous topic - Next topic

Bryan_abos

I want to make my main character to enter a room for the first time starting in a certain point (602, 101) to walk to a certain point in the room (625, 125), to look arround, and then to say something (in that order). The following times the character enters the room I only want him to walk to the same point.

This is as far as the tutorial and my intuition can take me.
Code: ags

function room_Load()
{
  gMaingui.Visible = true;
  gAction.Visible = true;
  player.x = 602;
  player.y = 101;
}

function room_FirstLoad()
{
  player.SayAt(625, 125, 100, "Momento.");
  player.FaceDirection(eDirectionRight);
  player.FaceDirection(eDirectionLeft);
  player.FaceDirection(eDirectionDown);
  player.Say("Si este es el capitulo uno...");
  player.Say("¿Que chucha llevo haciendo todo este rato?");
}

function room_AfterFadeIn()
{
  player.Walk(625, 125);
}


but when I press play, the character says everything what she is supposed to say, look arround, and then walk to the point she was supposed to walk at the beginning(in that order :-\). What do you think I'm doing wrong??

Vincent

I think you can try to switch player.Walk(625, 125); to player.Walk(625, 125, eBlock); and see if that works, otherwhise you will have to move the code from function first_load to room_AfterFadeIn after player walk in eBlock style. Or you could simply do something like this.

Code: ags

function room_AfterFadeIn()
{
  player.Walk(625, 125, eBlock);
  if (Game.DoOnceOnly("StartCutscene"))
  {
    player.SayAt(625, 125, 100, "Momento.");
    player.FaceDirection(eDirectionRight);
    player.FaceDirection(eDirectionLeft);
    player.FaceDirection(eDirectionDown);
    player.Say("Si este es el capitulo uno...");
    player.Say("¿Que chucha llevo haciendo todo este rato?");
  }
}

SMF spam blocked by CleanTalk