Game Development Community

Is this the most efficient way?

by Jon Jorajuria · in Torque Game Builder · 12/18/2006 (1:47 pm) · 0 replies

Oops, helps if I put something in...

I am trying to do blend animation with sprites, yes I am a bit odd here, but what I have is a player drift that is updated with the onSceneUpdate function. In order to play animations properly i have done the following:

Input Functions:

function playerClass::planeRight()
{
    $playerPlane01.moveRight = true;
    $playerPlane01.setCurrentAnimation();
}

Which calls the blend animation:
function playerClass::setCurrentAnimation(%this)
{
     %xVelocity = %this.getLinearVelocityX();
     %yVelocity = %this.getLinearVelocityY();  

     if (!$specialMoveB)
     {
      if(!%this.moveLeft && %this.moveRight)
      {
      	if(%this.getAnimation() $= "FlightAnimation")
      	{
      	  %this.playAnimation(BlendCenterToBankRightAnimation);
      	}
      	else
      	{
      		%this.playAnimation(BlendBankLeftToRightAnimation);
      	}      		    	 
      }

...
}

Which then does an onAnimationEnd callback

function playerClass::onAnimationEnd(%this)
{
   if(%this.getAnimation() $= "CenterToBankRightAnimation")
   {
      %this.playAnimation(BankRightAnimation);
   }

...
}

Or should I abondon sprites and use DTS objects?