Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Vera on Tue 13/01/2009 01:51:24

Title: Room jumps up before scrolling
Post by: Vera on Tue 13/01/2009 01:51:24
So I registered today just to ask about this. I've searched all over the forums and the manual and everywhere I can think of for the past couple days, and I can't figure this out.

I have a 320x240 game. I imported a 320x343 background. As of right now I have no characters yet, and for this room (my Intro/Title Screen room) I have ShowPlayerCharacter set to False.

Here's what I'm trying to achieve:

I want the game to fade in, showing the top portion of the background.

After a sec, the background begins to slowly scroll down. (A plus would be if I could adjust this speed to my liking)

Then, after a moment, my Title Image appears.
(Oh, and I also threw in a cutscene script so I can just skip to the Title Image)

The script I have currently:

// room script file

function room_AfterFadeIn()
{
StartCutscene(eSkipESCOnly);
int ypos = 0;
while (ypos < 120) {
  SetViewport(0, ypos);
  Wait(4);
  ypos = ypos +1;
}
{
EndCutscene();
oTitle.Visible = true;
}
}


My problem with this script:

What it's doing is showing the 320x240 view somewhere in the middle of my background for just a moment, then it jumps up to the top of the background and starts scrolling down. This jump is driving me nuts. It looks bad. I need it to just start at the top, not the middle.

How I tried fixing it

A.)   If I change this part...

int ypos = 0;

...to this:

int ypos = 40;

Then the jump no longer occurs. However, it also stops scrolling from the very top. It just starts the scroll down further, not showing the top part of my BG at all. No good!

B.)   I thought it might have something to do with the room's edges. BottomEdgeY, TopEdgeY... I messed around with those and it did nothing. After researching, I guess this only has to do with the character. No good!

Conclusion:

So I guess what I need is a way to set the view of the room to the top when it loads, instead of the middle, so that when it begins the scroll downward, it doesn't show the middle, jump up top, then scroll down. I'm sure I'm missing something obvious and silly, but if anyone could help with this part of my script or at least point me in the right direction, it would help greatly.

Thanks!
Title: Re: Room jumps up before scrolling
Post by: Anteater on Tue 13/01/2009 02:02:32
Add code in the before fade-in function to set the viewport to where you want it to start.
Title: Re: Room jumps up before scrolling
Post by: Khris on Tue 13/01/2009 02:05:00
Or, even easier, set the player character's y starting position to 10 or something like that.
Title: Lovely
Post by: Vera on Tue 13/01/2009 05:59:01
Ahh! I changed the character's starting position, and it works fine now!

I didn't realize there was even a character made, but I guess it's the default.

Thanks, everyone!
Title: Re: Room jumps up before scrolling
Post by: Khris on Tue 13/01/2009 13:35:21
Yes, there's always a player character and their starting room & position determines the first room of the game and the initial viewport.