Hello, I want to make a double jump but with my code it's really hard the double jump, you need to press the key too fast to make it.
any idea ?
this.onTheGround = this.player.body.blocked.down;
if(this.onTheGround) {
this.jumps = 3;
this.jumping = false;
}
// Jump!
if (this.jumps > 0 && this.cursors.up.isDown) {
this.player.body.velocity.y = -350;
this.jumping = true;
}
// Reduce the number of available
Hi, first part, resetting your jump properties if on ground, is OK:
this.onTheGround = this.player.body.blocked.down;
if(this.onTheGround) {
this.jumps = 3;
this.jumping = false;
}
Second part is problematic. To check if key was just pressed use justDown instead of isDown. Also code logic seems little bit strange to me.
In attachment you will find complete small endless runner example. I implemented your triple jump into it. It is written in TypeScript,