Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Pinback on Sun 13/12/2009 18:46:28

Title: Fading an object in...(Solved)
Post by: Pinback on Sun 13/12/2009 18:46:28
I found the following code in the manual to fade objects out,

Example:

int trans = object[0].Transparency;
while (trans < 100) {
 trans++;
 object[0].Transparency = trans;
 Wait(1);
}


But I can't seem to get it to do the opposite effect, ie, fade an object in.
Played around with it for a few hours but I'm kinda stumped. Anyone know how to do this?
Title: Re: Fading an object in...
Post by: NsMn on Sun 13/12/2009 18:53:01
Just replace the line "object[0].Transparency = trans" with "object[0].Transparency = 100-trans", that should work.
Title: Re: Fading an object in...
Post by: Pinback on Sun 13/12/2009 19:08:12
Thanks man, that works great.
Title: Re: Fading an object in...(Solved)
Post by: Helme on Sun 13/12/2009 22:13:28
Take a look at the tween-module. It contains a command called tween.transparency which is a simply shorter and includes more options for fading.