Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Alen101 on Thu 31/12/2015 04:44:58

Title: smooth viewport scroll back
Post by: Alen101 on Thu 31/12/2015 04:44:58
Hi, im trying to make the camera move lefting the character behind to allow the player to see a landscape and then back to the character.
Rigth now i have this and it run ok on the first part, but when the camera goes back it goes back without scrolling. It jumps to the player position.
How can i make a smooth scroll back like the scrolling on the first part?

Code (ags) Select
SetViewport(0, 134);
while (x<200)
{
  SetViewport(x,0);
  Wait(1);
   x++;
}
Title: Re: smooth viewport scroll back
Post by: Gilbert on Thu 31/12/2015 05:41:02
As you already moved the viewport from x = 0 to 200, why don't you just do the reverse?

Code (ags) Select

x=200;
while (x>=0)
{
  SetViewport(x,0);
  Wait(1);
   x--;
}

Title: Re: smooth viewport scroll back
Post by: Alen101 on Thu 31/12/2015 07:05:02
It works great! thank you very much!!!