# Character jump help

**URL:** <https://forum.kirupa.com/t/character-jump-help/305953>\
**Category:** programming\
**Created:** [March 6, 2010, 4:43am UTC](https://forum.kirupa.com/t/character-jump-help/305953 "2010-03-06T04:43:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kale542](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Kale542](https://forum.kirupa.com/u/Kale542)\
**Post date:** [March 6, 2010, 4:43am UTC](https://forum.kirupa.com/t/character-jump-help/305953/1 "2010-03-06T04:43:21Z")

</div>

Hi,

I’m making a game, and I need my guy to jump. Right now, he jumps, but more appears about 60 pixels higher, and then falls down regularly (i have a working “gravity” effect).  
I really need him to progress pixel by pixel instead of just springing around. I’ll attach the SWF so you know what i mean. (press up to jump)

Here’s my jump code:

```auto
    if (mainOnGround && !leftKeyDown && !rightKeyDown) {
        for (i=0;i<jumpHeight;i++) {
            mcMain.y -= jumpSpeed;
            mainOnGround = false;
        }
        for (i=0;i<jumpHeight;i++) {
            mcMain.y -= (jumpSpeed/2);
        }
            
    }

```

I have my variables set like this:

```auto
//whether or not the main guy is standing on something
var mainOnGround:Boolean = false;
//whether or not the main guy is jumping
var mainJumping:Boolean = false;
//the speed of the jump (must be divisable by 2)
var origJumpSpeed:Number = 0.0005;
var jumpSpeed:Number = origJumpSpeed;
//the maximum height of the jump (must be divisable by 2)
var jumpHeight:Number = 1000;

```

and the framerate at 100FPS

Thanks,  
Kale
