(currentLines)
| 829 | } |
| 830 | |
| 831 | UpdatePlayerRun(currentLines) { |
| 832 | this.isRunning = false; |
| 833 | let runAllowed = (!levels[this.currentLevelNo].isBlizzardLevel || this.currentLevelNo === 31 || this.currentLevelNo == 25); |
| 834 | if (this.isOnGround) { |
| 835 | if (!this.IsPlayerOnGround(currentLines)) { |
| 836 | this.isOnGround = false; |
| 837 | return; |
| 838 | } |
| 839 | if (!this.jumpHeld) { |
| 840 | if (this.rightHeld && runAllowed) { |
| 841 | this.hasFallen = false; |
| 842 | this.isRunning = true; |
| 843 | this.facingRight = true; |
| 844 | if (!levels[this.currentLevelNo].isIceLevel) { |
| 845 | this.currentSpeed = createVector(runSpeed, 0); |
| 846 | } else { |
| 847 | this.currentSpeed.x += playerIceRunAcceleration; |
| 848 | this.currentSpeed.x = min(runSpeed, this.currentSpeed.x); |
| 849 | |
| 850 | } |
| 851 | |
| 852 | } else if (this.leftHeld && runAllowed) { |
| 853 | this.hasFallen = false; |
| 854 | this.isRunning = true; |
| 855 | this.facingRight = false; |
| 856 | if (!levels[this.currentLevelNo].isIceLevel) { |
| 857 | this.currentSpeed = createVector(-runSpeed, 0); |
| 858 | } else { |
| 859 | this.currentSpeed.x -= playerIceRunAcceleration; |
| 860 | this.currentSpeed.x = max(0 - runSpeed, this.currentSpeed.x); |
| 861 | } |
| 862 | |
| 863 | |
| 864 | } else { |
| 865 | if (!levels[this.currentLevelNo].isIceLevel) { |
| 866 | this.currentSpeed = createVector(0, 0); |
| 867 | } else { |
| 868 | this.currentSpeed.y = 0; |
| 869 | if (this.IsMovingRight()) { |
| 870 | this.currentSpeed.x -= iceFrictionAcceleration; |
| 871 | } else { |
| 872 | this.currentSpeed.x += iceFrictionAcceleration; |
| 873 | } |
| 874 | if (abs(this.currentSpeed.x) <= iceFrictionAcceleration) { |
| 875 | this.currentSpeed.x = 0; |
| 876 | } |
| 877 | |
| 878 | } |
| 879 | } |
| 880 | |
| 881 | |
| 882 | } else { |
| 883 | |
| 884 | if (!levels[this.currentLevelNo].isIceLevel) { |
| 885 | this.currentSpeed = createVector(0, 0); |
| 886 | } else { |
| 887 | this.currentSpeed.y = 0; |
| 888 | if (this.IsMovingRight()) { |
no test coverage detected