Skip to content

Commit

Permalink
add sprint with 2x w
Browse files Browse the repository at this point in the history
  • Loading branch information
Leg0shii committed Apr 26, 2023
1 parent 23ba153 commit e3f985b
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.legoshi.parkourcalculator.parkour.simulator;

import de.legoshi.parkourcalculator.gui.debug.menu.ScreenSettings;
import de.legoshi.parkourcalculator.parkour.environment.Environment;
import de.legoshi.parkourcalculator.parkour.environment.blocks.ABlock;
import de.legoshi.parkourcalculator.parkour.environment.blocks.Ladder;
Expand All @@ -13,9 +12,6 @@
import lombok.Getter;
import lombok.Setter;

import java.awt.event.ItemEvent;
import java.util.List;

public class Player {

protected float width = 0.3F;
Expand All @@ -27,6 +23,7 @@ public class Player {
protected boolean LAVA;

protected boolean SPRINT;
protected int sprintToggleTimer;
@Getter protected boolean SNEAK;
protected boolean JUMP;

Expand Down Expand Up @@ -65,9 +62,14 @@ public Player(Vec3 position, Vec3 velocity, float startYAW) {
}

protected void updateTick(InputTick inputTick) {
boolean flag = inputTick.JUMP;

if (this.sprintToggleTimer > 0) {
--this.sprintToggleTimer;
}

boolean jumpFlag = inputTick.JUMP;
boolean isSNEAK = inputTick.SNEAK;
boolean flag2 = moveForward >= 0.8F;
boolean moveFlag = moveForward >= 0.8F;

moveStrafe = 0F;
moveForward = 0F;
Expand All @@ -85,8 +87,10 @@ protected void updateTick(InputTick inputTick) {
moveForward = (float) ((double) moveForward * 0.3D);
}

if (GROUND && !isSNEAK && !flag2 && moveForward >= 0.8F && !SPRINT) {
if (inputTick.SPRINT) {
if (GROUND && !isSNEAK && !moveFlag && moveForward >= 0.8F && !SPRINT) {
if (this.sprintToggleTimer <= 0) {
this.sprintToggleTimer = 7;
} else {
SPRINT = true;
}
}
Expand All @@ -105,6 +109,7 @@ protected void resetPlayer() {
this.position = this.startPos.copy();
this.velocity = this.startVel.copy();
this.realVel = this.startVel.copy();
this.sprintToggleTimer = 0;
YAW = startYAW;
GROUND = false;
WEB = false;
Expand Down

0 comments on commit e3f985b

Please sign in to comment.