Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: poc301 on Wed 18/03/2009 13:55:12

Title: Fading an object back out.. **RESOLVED**
Post by: poc301 on Wed 18/03/2009 13:55:12
EDIT ** Solved my own issue shortly after posting**

Used the code :

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


I guess it was that rounding issue, changing to use < 100 in the code helped out.

Sorry for the needless post.

-Bill


-------------

I am having a bit of a problem fading an object out.  I am basically fading an object in, waiting 4 seconds, then fading it out.

The object fades in fine, but I can't get it to fade out, and for the life of me, I don't see any problem with the code..  It is just reversing what the original did.  I even tried other methods to fade in that I found in older forum posts, but nothing is working.  Any help is appreciated..

CODE:


// FADE IN

object[2].Transparency = 100;   
object[2].Visible=true;

int a =100;   
while (a){     
object[2].Transparency=a;
      a--;
      Wait(1);   
      }

// DONE FADING IN


Wait(160);   // WAIT 4 SECONDS


//FADE OUT

while (a){     
object[2].Transparency=a;
      a++;
      Wait(1);   
      }
object[2].Visible=false;

// END FADE OUT



Like I said, it fades the object in fine, but won't fade out.  It just sits there waiting, then hits the visible=false command and the object vanishes. 

Thanks in advance.

Bill
Title: Re: Fading an object back out.. Checked the forum..
Post by: SSH on Wed 18/03/2009 14:16:10
While(a) should be while (a<100)
Title: Re: Fading an object back out.. **RESOLVED**
Post by: poc301 on Wed 18/03/2009 14:17:27
Thanks SSH, I figured it out just before you posted a reply. 

BTW: I love the overhotspot module you made up a while back :)

-Bill