Game Development Community

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:

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!

#1
10/16/2013 (10:56 am)
And as usual, I waste your time with a silly mistake. :P
%this.Owner.getObjAlpha
should have been written as
%this.Owner.getObjAlpha()
!