Jumping

Posted By: JakeBilbe

Jumping - 05/30/11 11:29

I know people will say go through the tutorials but as soon as I start I lose concentration. At the moment I am using:

Code:
if (key_space) 
{
me.z +=20; //if space is pressed jump
ent_animate(me,"jump",jump_percentage,ANM_CYCLE);
}
if (me.z > 25.1) 
{
c_move(me,vector(0,0,-6.5),nullvector,GLIDE); //if the player is above z.20 then glide down at 0.8 speed, enable collision
}



I want to make the model jump quite high and then glide down but this allows space to be held down and I want it so you can only press spacebar once so I assume I use a while statement I just dont know where?
Posted By: Pappenheimer

Re: Jumping - 05/30/11 16:25

Pseudo Code:

When pressing the jump key
first test whether the entity is on ground
if not, do nothing
else set a variable jump_strength at a certain value above the gravity value
insert the variable at the z position of the move vector in c_move
then reduce the value of the variable jump_strength, until its almost null,
then set it to null
and, don't forget to time correct it..
Posted By: JakeBilbe

Re: Jumping - 05/30/11 18:41

I dont suppose you could merge it with the code I posted? so that he falls gradually.

EDIT: also I have trouble concentrating on the template/workshops but if I actually got through them all would that give me enough knowledge to make a basic third person game? I will work through them later on when I get time because I really want to get into this but I just find it hard its like reading a book or something -_-
© 2024 lite-C Forums