Double Jump not Working

So I´ve been coding with phaser for a while and now I tried to make my first full game, apparently the game doesnt recognize the second input for a double jump, and I dont exactly know why, I tried using this.jump.isDown but that just makes the double jump infinite, and I dont want that, any help is useful :frowning:

            case Phaser.Input.Keyboard.JustDown(this.jump) && this.body.onFloor():
                this.body.setVelocityY(-250);
                this.anims.play('jump', true);
                break;

            case Phaser.Input.Keyboard.JustDown(this.jump) && !this.body.onFloor():
                this.setVelocityY(-250);
                this.anims.stop()
                this.anims.play('jump', true)
                break;

JustDown() returns true only once per key press, so you should call it only once per update.

const jumpJustDown = Phaser.Input.Keyboard.JustDown(this.jump)
1 Like

That sound logical, thanks! Its working perfectly now