Scroll and fade

Started by Chronos, Fri 20/08/2004 04:04:36

Previous topic - Next topic

Chronos

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!

Ishmael

#1
Handy, I'm sure people will find it usefull.

There's also this for complicated credits, and I've done fading and scrolling effects with Overlays...

----- EDIT to sharpen my point -----
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Gilbert

It's always a better choice if you can make an effect without using a plugin.

So, Chronos, simple but nice work.

Ishmael

That's basically what I meant, but I just stink in presenting myself to others...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Pumaman

Looks like handy code, thanks -- I'll move this to the Tech Archive in a couple of days :)

SMF spam blocked by CleanTalk