ChangeTransparency problem

Non-platform specific questions.

ChangeTransparency problem

Postby AlexVrs » Tue May 19, 2009 4:56 pm

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);
AlexVrs
 
Posts: 2
Joined: Tue May 19, 2009 4:51 pm
Score: 0 Give a positive score

Re: ChangeTransparency problem

Postby skydereign » Tue May 19, 2009 6:09 pm

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);
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: ChangeTransparency problem

Postby AlexVrs » Tue May 19, 2009 11:09 pm

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
AlexVrs
 
Posts: 2
Joined: Tue May 19, 2009 4:51 pm
Score: 0 Give a positive score

Re: ChangeTransparency problem

Postby skydereign » Tue May 19, 2009 11:14 pm

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);
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron