Higher Jump
by ArchonLight · in Torque Game Engine · 09/02/2008 (6:01 am) · 3 replies
I am now trying to implement something that will make my character jump higher when holding down the space button, but obviously I don't want the player to be able to hold it down forever and jump too high so there must be a cap on it.
Can this be solved by simply putting a new function into the default.bind.cs in the client folder?
thank you!!
Can this be solved by simply putting a new function into the default.bind.cs in the client folder?
thank you!!
About the author
Torque 3D Owner Andrew Wiblemo
Find the jump code and create a new server script function called chargedjump or somesuch, with variables of the player object, and a charge time.
In it, take the chargetime variable, cap it to a certain amount, then use it to scale up the applied impulse of a jump.
Create a client side function and bind it to your chareged jump key.
On keydown, set a clientside global to the current time. Call it JumpChargeStart or something
On keyup, send a cmdtoserver of chargedjump, passing current time - JumpChargeStart to it.
It's basically the same code tribes used for grenades.
Now you could do it a couple different ways too, but this is quite easy. Though, like tribes, it allows enterprising scripters to bind a key just to the cmdtoserver part, meaning every keypress after that first one will do a full strength jump.