Jump to content
  • 0
xholdz

Character Movement

Question

Hi guys. I am trying to implement a skip system in the source code, I already have all the formula and physics designed, however, for it to work I need to know which variable makes the player move, because so far I have not been able to find it. Here is the code:

 

public float velY;

public float gravity;

public int JumpHeight;

public float JumpSpeed ;

public float deltatime = Globals.System.GetTimeMs ();

public float timeTopeak;

 

 

void startJump ()

{

     gravity = (float) (2 * JumpHeight /       Math.Pow (timeTopeak, 2);                   JumpSpeed = gravity *                           timeTopeak;

}

 

public override bool Update () 

{

        velY + = gravity * deltatime * "var Move Down";

if (isGround ())

{

        velY = "var Move Down";

}

if (Controls.KeyDown(control.MoveUp) && IsGround () == true)

{

      yVel = JumpSpeed * "var Move Up";

}

 

This is it. 

Thanks for your attention. :)

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I don't think you're going to be able to copy/paste that right into the source like that. Mostly because we're dealing with a client and server. Secondly we're dealing with a tile based grid so fine pixel based movements aren't going to work.

 

Anyway, if you want to know where the player movement is handled I'd suggest looking at the movement packets both client and server side and see where those are both called from and where they lead.

 

You'll have to figure out a way to make the movement legal for the server side and look good on the client.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...