Cutscene, Showing specific side of an image first

Started by Rincew1nd, Tue 08/01/2008 22:11:00

Previous topic - Next topic

Rincew1nd

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.
Sploosh


Rincew1nd

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'
Sploosh

SupSuper

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.
Programmer looking for work

Rincew1nd

#4
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
Sploosh

Khris

Aren't you using 3.0? Because that's a 2.7x function.

Your script should look like this:
Code: ags
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.

Rincew1nd

Its only gone and worked, thank you so much to all who helped.
Sploosh

SMF spam blocked by CleanTalk