Jump oddity / question
by Andrew Edmonds · in Torque Game Engine · 04/02/2007 (12:39 am) · 2 replies
Hi all,
I've noticed something that I need to overcome in order to get something working in my game and was wondering if anyone could shed some light on the issue...
I have a need to allow the player to jump in a number of different ways (and each jump type has a different animation sequence) so I have created the necessary's in the engine and can now get and set the type using two new ConsoleMethods:
I've also assigned this to the scroll wheel so you can cycle through different jump types. All this is working and have tested multiplayer also.
Upon initialization, the player's jumpType = 1.
However, I've noticed that at the time of jumping, it always = 1 no matter what I have set it to.
To try and find out what is going on I have added the following to the code that sets the players actionThread for jumping:
I have also added an output to the console from script to say when the jump() function is called which outputs "Jumping - SCRIPT" to the console (as I believe it is called when the space bar is pressed and again when it is released).
So now, if I set my jumpType to, say, 3 either by using the mousewheel or by using %player.setJumpType(3); and then jump, the console output is:
So - the first and last lines are the jump button being pressed and then released. The 3rd line is outputting my actual jumpType. Where is it getting the 1 from on the second line??
If anyone has any ideas on this, please please let me know!!
Thanks guys...
I've noticed something that I need to overcome in order to get something working in my game and was wondering if anyone could shed some light on the issue...
I have a need to allow the player to jump in a number of different ways (and each jump type has a different animation sequence) so I have created the necessary's in the engine and can now get and set the type using two new ConsoleMethods:
getJumpType(); setJumpType(x);
I've also assigned this to the scroll wheel so you can cycle through different jump types. All this is working and have tested multiplayer also.
Upon initialization, the player's jumpType = 1.
However, I've noticed that at the time of jumping, it always = 1 no matter what I have set it to.
To try and find out what is going on I have added the following to the code that sets the players actionThread for jumping:
mJumpDelay = mDataBlock->jumpDelay;
mEnergy -= mDataBlock->jumpEnergyDrain;
Con::errorf("Jumping: %i", getJumpType()); //<--new line for debugging
setActionThread((mVelocity.len() < 0.5)?
PlayerData::StandJumpAnim: PlayerData::JumpAnim, true, false, true);I have also added an output to the console from script to say when the jump() function is called which outputs "Jumping - SCRIPT" to the console (as I believe it is called when the space bar is pressed and again when it is released).
So now, if I set my jumpType to, say, 3 either by using the mousewheel or by using %player.setJumpType(3); and then jump, the console output is:
Jumping - SCRIPT Jumping: 1 Jumping: 3 Jumping - SCRIPT
So - the first and last lines are the jump button being pressed and then released. The 3rd line is outputting my actual jumpType. Where is it getting the 1 from on the second line??
If anyone has any ideas on this, please please let me know!!
Thanks guys...
About the author
Formed in 2005, EiKON Games is an indie games development project based in the UK working on the tactical first person shooter "Epoch: Incursion". See the Join Us or Contact Us pages at http://www.eikon-games.com/
#2
In script I now check for the players jumpType and then depending on which it is I call a different mvTriggerCount:
I've then replicated the if (move->trigger[2] && !isMounted() && canJump()) block from player.cpp 2 more times and changed the actionThread for trigger[3] and trigger[4].
04/02/2007 (2:40 pm)
OK, I've solved it but to me it seems pretty hackish.In script I now check for the players jumpType and then depending on which it is I call a different mvTriggerCount:
switch(%val)
{
case 1:
$mvTriggerCount2++;
break;
case 2:
$mvTriggerCount3++;
break;
case 3:
$mvTriggerCount4++;
break;
default:
$mvTriggerCount2++;
}I've then replicated the if (move->trigger[2] && !isMounted() && canJump()) block from player.cpp 2 more times and changed the actionThread for trigger[3] and trigger[4].
Torque Owner Andrew Edmonds
EiKON Games