Hi everyone.
First of all I am using AGS 2.72.
Right before anyone tells me to read the manual or search for the answer. I Just want you all to know I have done this and came up with a few things I
thought would help but alas they did not. :(
I have a scrolling room of 1920x480 (a picture of outer space). Now what I am trying to do is create an intro sequence where the room scrolls from left to right.
But I want it to stop scrolling half way through. What I mean is that the room is three 640x480 sections. the first section will have writing on it I then want it to scroll to the next section (after mouse click) and then onto the third section (after mouse click). -(God I hope this is clear enough!)
Obviously the player character is not vissible because its a readable story intro with still pictures.
Can anyone help me please.
Thankyou
Jay.
You can use SetViewport.
int xpos = 0;
while (xpos < 640) {
SetViewport(xpos, 0);
Wait(1);
xpos = xpos + 4;
}
ReleaseViewport();
You might want to change the 4 in "xpos + 4" to something suitable, since this controls the speed.
Thanks TwinMoon.
I tried something exactly like that but without the "xpos = xpos + 4;".
But it now works with that line. Thanks.
However I removed the "ReleaseViewport();" as this sends the screen back to the begining.
One other question.
Is there anyway to get the scrolling to pause for a while at specific coords before continuing?
Jay.
Quote from: RetroJay on Tue 20/05/2008 01:15:51
However I removed the "ReleaseViewport();" as this sends the screen back to the begining.
Oh yeah right, it's a cutscene, so there's no player character. In which case releasing the viewport puts the screen back to 0,0. It was late ;)
Quote from: RetroJay on Tue 20/05/2008 01:15:51
One other question.
Is there anyway to get the scrolling to pause for a while at specific coords before continuing?
Of course. (xpos < 640) tells AGS to continue moving the viewport until its at 640 (two-thirds of your screen).
This code makes it travel half a screen, then another half:
int xpos = 0;
while (xpos < 320) {
SetViewport(xpos, 0);
Wait(1);
xpos = xpos + 4;
}
//do some stuff
while (xpos < 640) {
SetViewport(xpos, 0);
Wait(1);
xpos = xpos + 4;
}
Note that you don't have to declare xpos a second time.
Hi TwinMoon.
Thankyou ever so much for your help.
This works just as I wanted.
what is strange though is the coords I had to use to get it to work. Now I know originally I said I wanted it to pause half way through
But in actual fact I decide to pause it on the 1st quater 2nd and third so there will be dialoge on all three sections of the intro screen.
I calculated the coords needed but on the last section it didn`t travel far enough to the end and paused for a long time before game continued.
Anyway this is what I have ended up with and it works a treat.
DisplayMessage(0);
int xpos = 0;
while (xpos < 322) {
SetViewport(xpos, 0);
Wait(1);
xpos = xpos + 1;
}
//do some stuff
DisplayMessage(1);
while (xpos < 642) {
SetViewport(xpos, 0);
Wait(1);
xpos = xpos + 1;
}
//do some stuff
DisplayMessage(2);
while (xpos < 650) {
SetViewport(xpos, 0);
Wait(1);
xpos = xpos + 1;
}
If you can see where I have gone wrong with the coords then please let me know.
Once again. Thanks.
Jay.
Don`t worry. It was my fault. I didn`t need the third section at all. I was getting confused with my sections of screen and where my dialog was going. ::)
Just used your script as is and now it works like a (Good) dream. ;)
Thanks for your help.
Jay.