Game Development Community

How to play the sequence animation using the keyboard?

by Simon Siu-pun SHUM · in Torque Game Engine · 05/24/2006 (8:59 pm) · 3 replies

Hello,

i export all the animation to the .DSQ file and also i succeed to import all the sequence animation to the showtool.But, when i started to use the sequence in the game engine using the keyboard i.e. press one key and then play the sequence animation. It was failure.

there were some script showing my situation:

In the data/shapes/player/player.cs :

datablock TSShapeConstructor(PlayerDts)
{
baseShape = "./player.dts";
.
.
.
sequence8 ="./player_attack1.dsq attackFirst";
sequence9 ="./player_attack2.dsq attackSecond";
sequence10 ="./player_attack3.dsq attackThird";
sequence11 ="./player_attack4.dsq attackFourth";
.
.
.
};

Then, in the cilent/default.bind.cs :

.
.
.

function attackFirst :: %val()
{
playThread( 0,attackFirst );
}
.
.
.

moveMap.bind( keyboard, k, attackFirst );
.
.
.


Running in the gameEngine in console:

warn message: client/default.bind.cs (118): Unable to find function playThread

Thank all,

simon

#1
05/24/2006 (9:57 pm)
Playthread is a method of a shapebase object.



%object.playThread( 0,attackFirst );


course you want to make sure %object is a reference to the object
#2
05/24/2006 (11:16 pm)
Function attackFirst :: %val()
{
playThread( 0,attackFirst );
}

this should be something like:

function attackfirst(%pressed)
{
if(%pressed)
player_name.playThread( 0, "attackFirst" ); //where player_name is the name youve set for it
}

moveMap.bind( keyboard, k, attackFirst );

the letter k should be in double quotes
#3
05/25/2006 (8:43 am)
Thank you very much!!!

i tried your suggestion method to play the animation

but it still has no reaction and i press the key in game

please help me