()
| 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 |
no outgoing calls
no test coverage detected