Adding&Playing new animations
by Eylem Ugurel · in Torque Game Engine · 06/26/2006 (7:00 am) · 1 replies
I want to play some animations when user presses the corresponding keys.
I added
C++, to the player class:
-------------------------------
Client side:
--------------
Server side:
---------------
When i press 't' key for the first time, the animation is playing successfully, then stops and return to idle animation.
But when i press 't' key again, animation doesn't play.
Do you know where the problem is?
My player.cs file is:
I added
C++, to the player class:
-------------------------------
void Player::playAnimation(const char *Animation){
setState(NullState);
setActionThread(Animation, false, false, true);
}
void Player::stopAnimation(){
setState(MoveState);
}
ConsoleMethod( Player, playAnimation, void, 3, 3, "Return the current state name.")
{
object->playAnimation(argv[2]);
}
ConsoleMethod( Player, stopAnimation, void, 2, 2, "Return the current state name.")
{
object->stopAnimation();
}Client side:
--------------
function PlayAnim(%AnimationName){
commandToServer('PlayAnim', %AnimationName);
}
moveMap.bind( keyboard, t, "PlayAnim(\"wave\");" );Server side:
---------------
function Armor::animationDone(%this,%obj)
{
%obj.stopAnimation();
}
function serverCmdPlayAnim(%client, %Anim){
echo("serverCmdPlayAnim: " @ %Anim);
%client.player.playAnimation(%Anim);
}When i press 't' key for the first time, the animation is playing successfully, then stops and return to idle animation.
But when i press 't' key again, animation doesn't play.
Do you know where the problem is?
My player.cs file is:
datablock TSShapeConstructor(m1)
{
baseShape = "./player01.dts";
sequence0 = "./idle.dsq root";
sequence1 = "./walk.dsq back";
sequence2 = "./walk.dsq run";
sequence3 = "./walk.dsq side";
sequence4 = "./wave.dsq wave";
};About the author
Torque Owner Skylar Kelty
SkylarK