Jump to content

jump does not behave as I expect. need help!


Recommended Posts


I am using ARCADE physics for my phaser game and I am trying to make my character jump only when this guy is on the ground.

I have ground sprite does the collision and when the callback happens for ground, I get a variable called "onGround" to be true so whenever user push space bar it will jump but when its not onGround, I made the onGround to be false so it won't do the jump in the sky.

However, when it land on the ground, it almost feel like there is a delay of 8~10ms to be recorgnized as it collided with the ground? 

Did anybody had similar issue?

update function has below code for collision


this.onGround = false;

this.game.physics.arcade.collide(sprite, block, this.blockCollisionHandler, null, me);


blockCollisionHandler: function(){
        this.onGround = true;


jump: function(){
    if(this.onGround) this.sprite.vel.y = 1000; // peuso

Hope that make sense.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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