Why my breathing animation is not working in TGB?
by Angel Aurioles Duran · in Torque Game Builder · 11/15/2013 (10:46 am) · 6 replies
I followed the plattform ninja tutorial and I changed the ninja character for my own charro character, the first time that I ran the game everthing was ok (when my Charro wasn't doing anything the breathing animation could be seen) but later I add some echos to see the secuence of my functions and then when I earase this echos my Charro didn't breathing anymore, I checked all the code and everthing is like at the beggining but now my Charro doesn't run the animation. I did a test to see if my animation was running or not so I put the CharroRunAnimation instead of the CharroStandAnimation and it seems that the animation is stopped because it only shows the first frame of the CharroRunanimation. I don't knwow what happens?
function CharroClass::setCurrentAnimation(%this)
{
%xVelocity = %this.getLinearVelocityX();
%yVelocity = %this.getLinearVelocityY();
if (%xVelocity > 0)
{
%this.setFlip(false, false);
}
else if (%xVelocity < 0)
{
%this.setFlip(true, false);
}
if (%this.airborne)
{
if(%yVelocity < 0)
{
%this.playAnimation(CharroJumpUpAnimation);
return;
}else
{
%this.playAnimation(CharroJumpDownAnimation);
return;
}
}
if ($Charro.moveLeft == true || $Charro.moveRight == true)
{
if (%this.getAnimationName() $= "CharroRunAnimation")
{
if(%this.getIsAnimationFinished())
{
%this.playAnimation(CharroRunAnimation);
return;
}
}else
{
%this.playAnimation(CharroRunAnimation);
}
}else
{
// HERE SHOULD BE MY BREATHING OR STAND ANIMATION : %this.playAnimation(CharroStandAnimation);
%this.playAnimation(CharroRunAnimation);
}
}
#2
11/15/2013 (10:57 am)
yes I can see the echo
#3
11/15/2013 (11:01 am)
I put two echos: one line before that line and one after that line, I can see both echos and it looks like if the animation beggin but it stops cause I can see the first frame frozen
#4
11/15/2013 (11:02 am)
The breathing animation worked previously? So you know the AnimationAsset is loaded properly and contains valid data? Because if it's getting to that point in the code, the animation should be playing. The only thing I can think of besides invalid asset data is that somewhere else in code is overwriting the animation playing.
#5
11/15/2013 (11:16 am)
I think that the AnimationAsset is loaded properly and contain valid data cause when I move my Charro with right or left key the runCharroAnimation can be seen well, even I substituded the part of my code where I play the CharroRunAnimation and I put the CharroStandAnimation in that place to see if my breathing animation works, and yes when I pres the left or righ key my Charro breaths while moving.if (%this.getAnimationName() $= "CharroStandAnimation")
{
if(%this.getIsAnimationFinished())
{
%this.playAnimation(CharroStandAnimation);
return;
}
}
#6
11/15/2013 (1:26 pm)
Moved to Torque Game Builder forum.
Employee Michael Perry
ZombieShortbus
Do you see the echo? Want to make sure you are getting to that line of code.