Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Chronos on Fri 20/08/2004 04:04:36

Title: Scroll and fade
Post by: Chronos on Fri 20/08/2004 04:04:36
Hi all,

I was trying to make an intro for my future game and had a few problems to make the text fade in and out and scroll so i wrote a little function.

You must write your text on, let's say a pink background and import it as a sprite, make an object with it and set it to invisible, then call the function.

/*

obj = object number
x,y = object position
z =Ã,  scrolling up
speed = 0-fast 10-slow

-Chronos

*/

function scrollnfade(int obj, int x, int y, int z,int speed)
{
int i=0;
SetObjectPosition(obj,x,y);
SetObjectTransparency(obj,100);
ObjectOn(obj);
Ã, 
while(i<100)
{
SetObjectTransparency(obj,100-i);
Wait(7);
i=i+5;
}

i=0;
while(i<z)
{
Ã,  SetObjectPosition(obj,x,y-i);
Ã,  Wait(speed);
Ã,  i++;
}

i=0;
while(i<100)
{
SetObjectTransparency(obj,i);
Wait(7);
i=i+5;
}

}

(i'm currently coding a "scroll and fade" at the same time, if you want the code i ll post it here)

I hope this can help, bye!
Title: Re: Scroll and fade
Post by: Ishmael on Fri 20/08/2004 11:43:54
Handy, I'm sure people will find it usefull.

There's also this (http://www.adventuregamestudio.co.uk/games.php?action=detail&id=192) for complicated credits, and I've done fading and scrolling effects with Overlays...

----- EDIT to sharpen my point -----
Title: Re: Scroll and fade
Post by: Gilbert on Fri 20/08/2004 11:48:59
It's always a better choice if you can make an effect without using a plugin.

So, Chronos, simple but nice work.
Title: Re: Scroll and fade
Post by: Ishmael on Fri 20/08/2004 11:53:59
That's basically what I meant, but I just stink in presenting myself to others...
Title: Re: Scroll and fade
Post by: Pumaman on Fri 20/08/2004 20:10:59
Looks like handy code, thanks -- I'll move this to the Tech Archive in a couple of days :)