Search the Community

Showing results for tags 'double jump'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 3 results

  1. Hi guys, i have a code for the double jump, but sometimes this don't work correctly and my player can't jump, I'm noob with phaser, and someone can help me to optimize my code please This is my code(jumpCound and jumpMax has been declared in create function): this.upKey = this.game.input.keyboard.addKey(Phaser.Keyboard.UP); if(this.upKey.downDuration(20)) { if(this.jumpCount < this.jumpMax) { this.jumpCount++; this.player.body.velocity.y = -500; console.log(this.jumpMax + ' ' + this.jumpCount); } } if(this.player.body.blocked.down || this.player.body.touching.down) { this.jumpCount = 0; } This code has been declared in UPDATE function
  2. Hey all! I'm writing a program where I'm attempting to get my character to double jump in phaser. I've run into some issues. The logic of my code goes as follows player hits jump while on the ground -(jump set equal to one) if jump is set equal to one and the player is not on the ground, jump again. however, I cannot get my code to enter the second stage, and I'm not sure why. I've tried several different solutions but to no avail. I believe the problem may be within declaring var onTheGround = player.body.touching.down; and then !onTheGround for my second if statement. Any help would be appreciated, here is the full jump portion of my code: // Set a variable that is true when the player is touching the ground var onTheGround = player.body.touching.down, // (jumps is defined as 0 at the top of the code) // Allow the player to jump if they are touching the ground. if (cursors.up.isDown || upKey.isDown) { if (onTheGround && jumps == 0) { jumps = 1; console.log(jumps); //jump player.body.velocity.y = -200; } if (!onTheGround && jumps == 1) { jumps = 2; console.log(jumps); //jump again player.body.velocity.y = -500; } jumps = 0; }
  3. karneekarnay

    Key Events help

    Hi Guys, I'm pretty new to Phaser Game development. I'm trying to make a cool 2D platformer. I've created a very basic first level, enough to let me start working on the player controls. One thing I want to do is add a double jump feature to my player. I'm trying to find something like a key.up function to use to stop it so my player doesn't just hold down the spacebar to jump really high. Here is my code behind jumps below. if (userKeys[2].onDown && player.jumpCount < 2) { player.body.velocity.y = -350*upForce; player.jumpCount++; console.log(player.jumpCount); } I think what I need is the processKeyUp function, in the keyboard.js. I'm not sure how I call it. Any ideas? Also right now I am using Cloud9 as my development environment. I've heard good things about mighty editor. Which one do you guys prefer?