Jump to content

Jump X Velocity help


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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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