Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: DCS78 on Tue 10/04/2012 02:49:13

Title: Change room when music ends [SOLVED]
Post by: DCS78 on Tue 10/04/2012 02:49:13
I want to be able to change rooms when my music ends and be able to skip on a button press. Each of the following scripts work as expected but I want to combine them. Any ideas?


function room_AfterFadeIn()
{
 while (!mouse.IsButtonDown(eMouseLeft) && !IsKeyPressed(13) && !IsKeyPressed(27) && !IsKeyPressed(32))
 {
   Wait(1);
 }

 player.ChangeRoom(3);
}


or


function room_AfterFadeIn()
{
 Wait(400);
 player.ChangeRoom(3);
}
Title: Re: Change room when music ends
Post by: Gilbert on Tue 10/04/2012 02:53:03
Something like this should work:

function room_AfterFadeIn()
{
  int tempcount = 0;
  while (!mouse.IsButtonDown(eMouseLeft) && !IsKeyPressed(13) && !IsKeyPressed(27) && !IsKeyPressed(32) && tempcount<400)
  {
    Wait(1);
    tempcount++;
  }

  player.ChangeRoom(3);
}
Title: Works
Post by: DCS78 on Tue 10/04/2012 06:56:28
Thank you, works perfectly.