Jump to content

Jump X Velocity help


Heppell08
 Share

Recommended Posts

Its just a basic bit of help i need but what im asking for is if anyone has a snip of code that stops the player being able to drift in the sky when jumping along the X for so long. My game is a pretty heavy user of very specific gravity and velocity jump features but the player can basically glide after jumping. I want the player to not be able to do that. 

Heres my control system:

if(cursors.left.isDown)        {            player.body.velocity.x = -300;            if(facing !== 'left')            {                player.scale.x *=-1;                            facing = 'left';            }            }        else if (cursors.right.isDown)        {            player.body.velocity.x = 300;              if(facing !== 'right')            {                player.scale.x *=-1;                facing = 'right';            }        }        if (jumpButton.isDown && player.body.onFloor() && this.time.now > jumpTimer)        {            player.body.velocity.y = -110;            jumpTimer = this.time.now + 750;        }

So if anyone knows a way to stop movement when airborne i'd really appreciate it.

 

Using phaser 1.1.5.

I've tested linear damping but that didnt seem to do anything. 

Thanks :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...