Problem With a Fade
by Orion the Hunter · in Torque Game Builder · 10/15/2013 (7:31 pm) · 1 replies
I've been working on a "fade-in" function for my Falling Platform Behavior. It's supposed to fade the platform back in as it recovers. I have:
I made get/setObjAlpha functions.
They work outside of the script context, but they don't want to work when they're called in the FadeIn function. On top of that, I get an endless repeat of the line "FPB:FadeIn... " (The space would have the alpha decimal number... if it worked.)
What am I doing wrong?
Thanks!
function FallingPlatformBehavior::FadeIn( %this )
{
if(%this.Owner.getObjAlpha < 1)
{
%number = %this.getObjAlpha += %this.fadeSpeed / 100;
%this.Owner.setObjAlpha(%number);
%this.schedule(32, "FadeIn");
echo("FPB:FadeIn... " @ %this.Owner.getObjAlpha);
}
}I made get/setObjAlpha functions.
function t2dSceneObject::setObjAlpha(%this, %number)
{
%blendRed = getWord(%this.blendColor, 0);
%blendGreen = getWord(%this.blendColor, 1);
%blendBlue = getWord(%this.blendColor, 2);
%this.blendColor = %blendRed SPC %blendGreen SPC %blendBlue SPC %number;
}
function t2dSceneObject::getObjAlpha(%this)
{
%blendAlpha = getWord(%this.blendColor, 3);
echo(%blendAlpha);
return %blendAlpha;
}They work outside of the script context, but they don't want to work when they're called in the FadeIn function. On top of that, I get an endless repeat of the line "FPB:FadeIn... " (The space would have the alpha decimal number... if it worked.)
What am I doing wrong?
Thanks!
Orion the Hunter
Fritterflames