Okay, with your help, I got it to work. Here is the code:
Code: ags
function btnInv_OnClick(GUIControl *control, MouseButton button) //turn invisible button
{
if (invisible==false)//Is the character already invisible?
{
//Play animation & set view
int trans = cEgo.Transparency;
while (trans < 51)
{
trans++;
cEgo.Transparency = trans;
Wait(1);
cEgo.Transparency=50;
}
invisible=true; //Turns on invisible variable.
}
else //If is already invisible, character turns back to normal
{
int transoff = 50;
while (transoff > 0)
{
transoff--;
cEgo.Transparency = transoff;
Wait(1);
}
invisible=false; //Resets invisible variable
}
}