Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: croquetasesina on Fri 22/03/2019 17:32:15

Title: scrolling with slow return (SOLVED)
Post by: croquetasesina on Fri 22/03/2019 17:32:15
I want to do a scrolling in a room, using

Code (ags) Select

int x;
while (x<250) {
   SetViewport(x,0);
   x++;
   Wait(1);
}
ReleaseViewport();


But when the scrolling finish, return to the start position quickly in a jump. I would like to make the return slowly. Is it possible?
Title: Re: scrolling with slow return
Post by: Crimson Wizard on Fri 22/03/2019 19:17:35
Just make the same going opposite way?

Either remember where it was by saving viewport position in a variable, or use player.x for the reference.
Title: Re: scrolling with slow return
Post by: croquetasesina on Fri 22/03/2019 21:11:02
Thanks to Crimson_Wizard I got to do what I was trying with the following code


Code (ags) Select

int x;
while (x<250) {
   SetViewport(x,0);
   x++;
   Wait(1);
}
Wait(50);
while (x>0) {
   SetViewport(x,0);
   x--;
   Wait(1);
}
ReleaseViewport();