Page 1 of 1

ChangeTransparency problem

PostPosted: Tue May 19, 2009 4:56 pm
by AlexVrs
I need to make a graphic blink by smoothly fadein/out.
I made a new actor variable alpha so I can use it with ChangeTransparency but it doesn't work,

in the Draw actor Event:
Code: Select all
if (titlePressStart.transp>0.9)
{
alpha=alpha-0.1;
ChangeTransparency("titlePressStart",alpha);
}
if (titlePressStart.transp<0.1)
{
alpha=alpha+0.1;
ChangeTransparency("titlePressStart",alpha);

Re: ChangeTransparency problem

PostPosted: Tue May 19, 2009 6:09 pm
by skydereign
Well, the problem you seem to have may be an int problem. What type of variable did you make? When you make it, you should select real if you didn't. That is not the only possible problem, as the code that you have won't work... The problem is that it only reduces if the transparency is above .9, and only increases if it is less than .1. So, it does not do anything in the middle. Another possible problem is your variable needs to fit not only the domain, but also the transp. This is one way to fix it, but I can't think of a better one right now... This just uses an int, so you would not need to change it to real. Hope this helps.
Code: Select all
switch(fade)
{
  case 0:
  ChangeTransparency("Event Actor",transp+.01);
  break;
  case 1:
  ChangeTransparency("Event Actor",transp-.01);
  break;
}
if(transp=>.9 || transp<=.1)
{
    fade=round(transp);
}

Re: ChangeTransparency problem

PostPosted: Tue May 19, 2009 11:09 pm
by AlexVrs
I made a 'fade' integer variable and used:
Code: Select all
switch(fade)
{
  case 0:
  ChangeTransparency("titlePressStart",transp+.01);
  break;
  case 1:
  ChangeTransparency("titlePressStart",transp-.01);
  break;
}
if(transp=>.9 || transp<=.1)
{
    fade=round(transp);
}


But now I get an error: Error line 10, unknown type in binhconst

Re: ChangeTransparency problem

PostPosted: Tue May 19, 2009 11:14 pm
by skydereign
Sorry, wrote it wrong.
Code: Select all
switch(fade)
{
  case 0:
  ChangeTransparency("titlePressStart",transp+.01);
  break;
  case 1:
  ChangeTransparency("titlePressStart",transp-.01);
  break;
}
if(transp>=.9 || transp<=.1)
{
    fade=round(transp);
}