Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Rincew1nd on Tue 08/01/2008 22:11:00

Title: Cutscene, Showing specific side of an image first
Post by: Rincew1nd on Tue 08/01/2008 22:11:00
Hello i have made a long image (so it scrolls as you walk) but i want to show the right hand side of the image then show the left after a certain amount of seconds, since this is a cutscene i dont want the character visable or walking. Heres an example.

http://img87.imageshack.us/img87/582/exampmi3.png

Im using the new RC4 3.0 version of ags so I'm still getting used to that.
Title: Re: Cutscene, Showing specific side of an image first
Post by: Cino on Tue 08/01/2008 22:15:51
Viewport is the keyword for this.
Title: Re: Cutscene, Showing specific side of an image first
Post by: Rincew1nd on Tue 08/01/2008 22:23:04
i found this

int ypos = 0;
while (ypos < 60) {
  SetViewport(0, ypos);
  Wait(1);
  ypos++;
}
ReleaseViewport();



so to make it go along the x axis it would be


int xpos = 484;
while (xpos < 60) {
  SetViewport(140, xpos);
  Wait(1);
  xpos++;
}
ReleaseViewport();




*edit* damn i get

Failed to save room room1.crm; details below
room1.asc(3): Error (line 3): Parse error: unexpected 'while'
Title: Re: Cutscene, Showing specific side of an image first
Post by: SupSuper on Tue 08/01/2008 22:44:20
You have to put the code inside an event function, like "Enters room after fadein". Also, to have it go right-to-left, you need to switch some stuff around:

int xpos = 484;
while (xpos > 60) {
  SetViewport(xpos, 140);
  Wait(1);
  xpos--;
}
ReleaseViewport();

This would scroll the viewport from X=484 to X=60.
Title: Re: Cutscene, Showing specific side of an image first
Post by: Rincew1nd on Tue 08/01/2008 23:05:04
doesnt seem to work, the image just stays centered


// text script for room
#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for Room: Player enters room (after fadein)
int xpos = 484;
while (xpos > 60) {
  SetViewport(xpos, 140);
  Wait(1);
  xpos--;
}
ReleaseViewport();

}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE



Heres an image of a test scene im using

http://img204.imageshack.us/img204/8749/15738030yb4.jpg
Title: Re: Cutscene, Showing specific side of an image first
Post by: Khris on Tue 08/01/2008 23:48:55
Aren't you using 3.0? Because that's a 2.7x function.

Your script should look like this:
function room_AfterFadeIn()
{
  // scrolling code
}


Don't copy/paste whole functions, just the contents. (Especially not from one version to another.)
In the room editor, click the flash icon above the properties window, then select the event and click the small ...-button. AGS will create the function and open the room script window with the cursor at the start of the function. Now put the code inside the function.
The reason your code isn't working: room_a() is never called.
Title: Re: Cutscene, Showing specific side of an image first
Post by: Rincew1nd on Tue 08/01/2008 23:53:22
Its only gone and worked, thank you so much to all who helped.