storing a keypress to use with another keypress
by Robert Grant · in Torque Game Engine · 12/05/2009 (5:17 pm) · 1 replies
ive been searching and doing tests with simset, simobject, scriptobject etc but still have a very basic understanding of these.
what i am looking to do is link an animation to a keypress then from that animation, when another key is pressed, blend the animation with the previous animation.
it would look something like this
------------------
%presskey
play animation
stop on last frame
%pressnextkey
if %lastkey = %presskey
play animation from the last key with the animation of this key
------------------
another example would be
play kick animation
move foot to higher position from kick animation resulting in a second kick in a differnt spot
so what im thinking i need to do is store the keypress from the first
then have it understand what was the last keypress
store the keypress from the second
add the two togther to know which animation to play to take the foot to the position of the second key pressed
not quite sure which route to go down to acomplish this so any ideas would be appreciated
thanks
what i am looking to do is link an animation to a keypress then from that animation, when another key is pressed, blend the animation with the previous animation.
it would look something like this
------------------
%presskey
play animation
stop on last frame
%pressnextkey
if %lastkey = %presskey
play animation from the last key with the animation of this key
------------------
another example would be
play kick animation
move foot to higher position from kick animation resulting in a second kick in a differnt spot
so what im thinking i need to do is store the keypress from the first
then have it understand what was the last keypress
store the keypress from the second
add the two togther to know which animation to play to take the foot to the position of the second key pressed
not quite sure which route to go down to acomplish this so any ideas would be appreciated
thanks
About the author
Torque Owner Robert Grant
$first = "null";
moveMap.bindCmd(keyboard, "numpad1", "", "numpad1();");
function numpad1()
{
echo("numpad 1 pressed -+-+-+- ");
echo($first);
if ($first $= "null")
{
$first = "one";
echo("$first=" SPC $first);
}
else if ($first !$= "")
{
$second ="one";
echo("call working");
echo("$first=" SPC $first);
echo("$second=" SPC $second);
combo();
}
}
function combo()
{
echo("combo call working");
if($first $= "one" && $second $= "one")
{
echo("do one and one animation");
}
}
this example will save one keypress and do something when another keypress is pushed if the resulting strings are true
would using simsets and or simobjects be any better than this approach?
at this point i do not understand how they work