Changing Alpha with scripting.
by Joey Gutierrez · in Torque Game Builder · 01/13/2008 (12:06 pm) · 2 replies
Well I am trying to work on a game for my senior project. I know how to set up the Alpha under the edit tab so that something may appear more transparent. What I am wondering, though, is how can I change this alpha with scripting???
Which function would it be best to put this in, and how would it be written???
I've tried things like
'classname'.Alpha = "number";
and
%this.Alpha = number;
Any help will be appreciated.
Which function would it be best to put this in, and how would it be written???
I've tried things like
'classname'.Alpha = "number";
and
%this.Alpha = number;
Any help will be appreciated.
About the author
Torque Owner Aaron K Murray
function Fade(%object, %toAlpha, %timeMs, %deleteWhenDone) { echo("Fade" SPC %object SPC %toAlpha SPC %timeMs SPC %deleteWhenDone); if (isObject(%object)) { if(%timeMs > $FADE::GRANULARITY) { %alpha = %object.getBlendAlpha(); %updatesRemaining = %timeMs / $FADE::GRANULARITY; %alpha += (%toAlpha - %alpha) / %updatesRemaining; %object.setBlendAlpha(%alpha); schedule($FADE::GRANULARITY, 0, Fade, %object, %toAlpha, %timeMs - $FADE::GRANULARITY, %deleteWhenDone); } else { %object.setBlendAlpha(%toAlpha); if (%deleteWhenDone == true) %object.safeDelete(); } } }