Corrected spelling

This commit is contained in:
OLEGSHA 2021-01-11 11:25:42 +03:00
parent a67d3ba1bb
commit 02ef94a395
2 changed files with 16 additions and 19 deletions

View File

@ -66,8 +66,8 @@ public class LayerTestGUI extends GUILayer {
)); ));
panel.addChild(new Label( panel.addChild(new Label(
"IsSprintDisplay", font, "IsSprintingDisplay", font,
() -> String.format("Sprint: %5s (W x2)", TestPlayerControls.getInstance().isSprint()) () -> String.format("Sprinting: %5s (W x2)", TestPlayerControls.getInstance().isSprinting())
)); ));
panel.addChild(new Label( panel.addChild(new Label(

View File

@ -38,25 +38,25 @@ public class TestPlayerControls {
private static final double MIN_JUMP_DELAY = 300 * Units.MILLISECONDS; private static final double MIN_JUMP_DELAY = 300 * Units.MILLISECONDS;
// Horizontal and vertical max control speed when flying // Horizontal and vertical max control speed when flying
private static final float FLYING_SPEED = 6.0f * Units.METERS_PER_SECOND; private static final float FLYING_SPEED = Units.get("6 m/s");
// (0; 1], 1 is instant change, 0 is no control authority // (0; 1], 1 is instant change, 0 is no control authority
private static final float FLYING_CONTROL_AUTHORITY = Units.get("2 1/s"); private static final float FLYING_CONTROL_AUTHORITY = Units.get("2 1/s");
// Horizontal and vertical max control speed when walking // Horizontal max control speed when walking
private static final float WALKING_SPEED = 4.0f * Units.METERS_PER_SECOND; private static final float WALKING_SPEED = Units.get("4 m/s");
// Horizontal and vertical max control speed when run // Horizontal max control speed when sprinting
private static final float RUN_SPEED = 6.0f * Units.METERS_PER_SECOND; private static final float SPRINTING_SPEED = Units.get("6 m/s");
// (0; 1], 1 is instant change, 0 is no control authority // (0; 1], 1 is instant change, 0 is no control authority
private static final float WALKING_CONTROL_AUTHORITY = Units.get("15 1/s"); private static final float WALKING_CONTROL_AUTHORITY = Units.get("15 1/s");
// Vertical velocity instantly add to player when they jump // Vertical velocity instantly added to player when they jump
private static final float JUMP_VELOCITY = 5f * Units.METERS_PER_SECOND; private static final float JUMP_VELOCITY = 5f * Units.METERS_PER_SECOND;
private boolean isFlying = true; private boolean isFlying = true;
private boolean isSprint = false; private boolean isSprinting = false;
private int movementForward = 0; private int movementForward = 0;
private int movementRight = 0; private int movementRight = 0;
@ -86,11 +86,8 @@ public class TestPlayerControls {
if (isFlying) { if (isFlying) {
speed = FLYING_SPEED; speed = FLYING_SPEED;
authority = FLYING_CONTROL_AUTHORITY; authority = FLYING_CONTROL_AUTHORITY;
} else if (isSprint) {
speed = RUN_SPEED;
authority = WALKING_CONTROL_AUTHORITY;
} else { } else {
speed = WALKING_SPEED; speed = isSprinting ? SPRINTING_SPEED : WALKING_SPEED;
authority = WALKING_CONTROL_AUTHORITY; authority = WALKING_CONTROL_AUTHORITY;
} }
@ -195,7 +192,7 @@ public class TestPlayerControls {
double timeSinceLastSpacePress = GraphicsInterface.getTime() - lastSpacePress; double timeSinceLastSpacePress = GraphicsInterface.getTime() - lastSpacePress;
if (isPressed && timeSinceLastSpacePress < MODE_SWITCH_MAX_DELAY) { if (isPressed && timeSinceLastSpacePress < MODE_SWITCH_MAX_DELAY) {
isSprint = false; isSprinting = false;
isFlying = !isFlying; isFlying = !isFlying;
updateGUI(); updateGUI();
movementUp = +1; movementUp = +1;
@ -217,14 +214,14 @@ public class TestPlayerControls {
double timeSinceLastSpacePress = GraphicsInterface.getTime() - lastSprintPress; double timeSinceLastSpacePress = GraphicsInterface.getTime() - lastSprintPress;
if (event.isPress() && timeSinceLastSpacePress < MODE_SPRINT_SWITCH_MAX_DELAY && !isFlying) { if (event.isPress() && timeSinceLastSpacePress < MODE_SPRINT_SWITCH_MAX_DELAY && !isFlying) {
isSprint = !isSprint; isSprinting = !isSprinting;
updateGUI(); updateGUI();
} }
lastSprintPress = GraphicsInterface.getTime(); lastSprintPress = GraphicsInterface.getTime();
if (isSprint && event.isRelease()) { if (isSprinting && event.isRelease()) {
isSprint = false; isSprinting = false;
updateGUI(); updateGUI();
} }
} }
@ -359,8 +356,8 @@ public class TestPlayerControls {
return isFlying; return isFlying;
} }
public boolean isSprint() { public boolean isSprinting() {
return isSprint; return isSprinting;
} }
public boolean isMouseCaptured() { public boolean isMouseCaptured() {