Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: AlphaMole on Fri 03/10/2003 08:23:16

Title: intro scroll
Post by: AlphaMole on Fri 03/10/2003 08:23:16
hey, im making a short demo for my game and I was wondering if there was a way to scroll a background up while displaying text on the screen
Title: Re:intro scroll
Post by: on Fri 03/10/2003 10:12:00
What kind of text do you mean? If you use Overlays, then the scrolling should be possible with some while loop, and if the bg should scroll for a longer time, the looing room script might help. I'm not on my own machine, so I have no example to consult... but since the screen follows the player character, you can do:

in room - player enters screen (after fadein):

int scroll, disp, overl;

while (scroll < 640) { //say, you have a rom 700 wide, which shold scroll from end to end once
scroll ++ ;
character[EGO].x = scroll;
// Place the display command conditional's here,
like:
if (scroll == 100) disp = 1;
else if (scroll == 130) disp = 2;
else if (scroll == 170) disp = 3;
if (disp == 1) overl = CreateTextOverlay(20,90,180,1,14,"Text here, yellow");
else if (disp == 2) SetTextOverlay(overl,20,90,180,1,9,"Other text here, light blue");
else if (disp == 3) SetTextOverlay(overl,20,90,180,1,7,"Yet another text, light gray");
}

Using this, every time you enter the room the sequence is repeated. You should probably hide the player character...
Title: Re:intro scroll
Post by: on Fri 03/10/2003 10:13:17
And forgot... add Wait(1); to the end of the script, before the }
Title: Re:intro scroll
Post by: AlphaMole on Fri 03/10/2003 15:54:35
ok, so "character[EGO].x = scroll;" is what actually does the scrolling, am I right?
and I can change that to .y for a virtical scroll?

why is there two sets of if-else statments, or am I missing something?
Title: Re:intro scroll
Post by: AlphaMole on Fri 03/10/2003 16:11:09
hmm.. I see the reason now for two if-else. but It's not running for some reason "too many displays" now that's not right...


EDIT:: took out one if-else statment block, it was exicuting the create text about 30 times before changing
Title: Re:intro scroll
Post by: Arcangel on Sat 04/10/2003 01:55:59
You can also prove this that you that it works.But before: Is your game hi-color? because in another way this doesn't work  
 
 
/ / room script file  
 
function room_a () {  
 / / script for room: Player enters screen (before fadein)  
HideMouseCursor ();  
SetCharacterTransparency(HICOLOR,100);  / / character or something created in Hi_color for transparency
MoveCharacter(HICOLOR,1223,113); / / will move toward the right  my scroll to right i set it 160,113
SetTimer(2,120); / / several timer to know when to change the texts  
SetTimer(3,240);  
SetTimer(4,360);  
SetTimer(5,480);  
}  
 
function room_b () {  
 / / script for room: Repeatedly execute  
/ / A single GUI and change the text in a graphic way  
if (GetGlobalInt(1)==1){SetGUIPosition(0,50,210);SetButtonPic(0,0,1,41);SetGlobalInt(1,2);} / / The first one this position from the beginning  
if (IsTimerExpired(2)==1){SetGUIPosition(0,90,210);SetButtonPic(0,0,1,42);}  
if (IsTimerExpired(3)==1){SetGUIPosition(0,70,210);SetButtonPic(0,0,1,43);}  
if (IsTimerExpired(4)==1){SetGUIPosition(0,100,210);SetButtonPic(0,0,1,44);}  
if (IsTimerExpired(5)==1){GUIOff(0);}  
}