MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / Jump

Method Jump

Player.js:683–709  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

681 }
682
683 Jump() {
684 if (!this.isOnGround) {
685 return;
686 }
687
688 let verticalJumpSpeed = map(this.jumpTimer, 0, maxJumpTimer, minJumpSpeed, maxJumpSpeed)
689 // print(this.jumpTimer,minJumpSpeed,maxJumpSpeed,verticalJumpSpeed )
690 if (this.leftHeld) {
691 this.currentSpeed = createVector(-jumpSpeedHorizontal, -verticalJumpSpeed)
692 this.facingRight = false;
693 } else if (this.rightHeld) {
694 this.currentSpeed = createVector(jumpSpeedHorizontal, -verticalJumpSpeed)
695 this.facingRight = true;
696
697 } else {
698 this.currentSpeed = createVector(0, -verticalJumpSpeed)
699 }
700 this.hasFallen = false;
701 this.isOnGround = false
702 // print(this.jumpTimer);
703 this.jumpTimer = 0
704 this.jumpStartingHeight = (height - this.currentPos.y) + height * this.currentLevelNo;
705 if (!mutePlayers|| testingSinglePlayer) {
706 jumpSound.playMode('sustain');
707 jumpSound.play();
708 }
709 }
710
711 // to determine if we are colliding with any walls or shit we need to do some collision detection
712 // this is done by taking the collision of the 4 lines that make up the hitbox

Callers 3

EndCurrentActionMethod · 0.95
keyReleasedFunction · 0.80
keyReleasedFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected