Forum

Tutorial: Quake World Style Jumping

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Tutorial: Quake World Style Jumping

Postby Team Xlink » Wed Aug 19, 2009 8:50 pm

Hello.

Credit for this tutorial goes to Electro.

Step One.

Open up Client.qc

Create a float client.qc at the top
Call it:
Code: Select all
.float jump_remember;


This will be for when people are in the air and press jump.

While people are in the air, and press jump, we set it to TRUE. Then when they land, if they're on the ground and have this flag set to TRUE, then we make it execute the jump.

So next up is to make it set to TRUE if you press jump while in the air.


Find Player Jump in Client.qc and scroll down until you find this:

Code: Select all
if (!(self.flags & FL_ONGROUND))
        return;

Change it to be this:

Code: Select all
if (!(self.flags & FL_ONGROUND))
{
        self.jump_remember = TRUE;
        return;
}


Below, where it does:

Code: Select all
self.button2 = 0;


Add this right after it:
Code: Select all
self.jump_remember = FALSE;


Still in Player Jump.

Add this:

Code: Select all
      self.velocity = v_forward + (self.velocity * 1.05);//small push when jumping
      self.velocity = v_right   + (self.velocity * 1.05);//small push when jumping



Now, we want to make it so it jumps if they have jump_remember TRUE, or button2 pressed.

In PlayerPreThink find this:
Code: Select all
if (self.button2)


Change it to:
Code: Select all
if ( (self.button2) || (self.jump_remember) )


That is all there is too it.
Last edited by Team Xlink on Thu Aug 27, 2009 4:27 am, edited 1 time in total.
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Postby r00k » Thu Aug 20, 2009 4:23 am

in PlayerJump i've used this near the end..

Code: Select all
      self.velocity = v_forward + (self.velocity * 1.05);//small push when jumping
      self.velocity = v_right   + (self.velocity * 1.05);//small push when jumping


seems to work well for me...

Oh wait, jump, press jump again in netquake and hold will make u jump when u land... i thought u meant mimicing QW strafe jumping for netQuake :o
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby Team Xlink » Thu Aug 27, 2009 4:25 am

Yeah, that is the goal of this tutorial, it seems that I forgot the part that increases your velocity, so I added that part now, thank you r00k.
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest