v1.2.0: slightly increased the duration and consistency of heldDelay

This commit is contained in:
Evan Debenham 2022-02-20 19:00:26 -05:00
parent 4a1e7da993
commit de1e628ad0

View File

@ -247,6 +247,9 @@ public class CellSelector extends ScrollArea {
private GameAction heldAction3 = SPDAction.NONE; private GameAction heldAction3 = SPDAction.NONE;
private float heldDelay = 0f; private float heldDelay = 0f;
//note that delay starts ticking down on the frame it is processed
// so in most cases the actual wait is 50-58ms
private static final float INITIAL_DELAY = 0.06f;
private boolean delayingForRelease = false; private boolean delayingForRelease = false;
private Signal.Listener<KeyEvent> keyListener = new Signal.Listener<KeyEvent>() { private Signal.Listener<KeyEvent> keyListener = new Signal.Listener<KeyEvent>() {
@ -300,7 +303,7 @@ public class CellSelector extends ScrollArea {
delayingForRelease = true; delayingForRelease = true;
//in case more keys are being released //in case more keys are being released
//note that this delay can tick down while the hero is moving //note that this delay can tick down while the hero is moving
heldDelay = 0.05f; heldDelay = INITIAL_DELAY;
} }
} else if (directionFromAction(action) != 0) { } else if (directionFromAction(action) != 0) {
@ -309,7 +312,7 @@ public class CellSelector extends ScrollArea {
lastCellMoved = -1; lastCellMoved = -1;
if (heldAction1 == SPDAction.NONE){ if (heldAction1 == SPDAction.NONE){
heldAction1 = action; heldAction1 = action;
heldDelay = 0.05f; heldDelay = INITIAL_DELAY;
delayingForRelease = false; delayingForRelease = false;
} else if (heldAction2 == SPDAction.NONE){ } else if (heldAction2 == SPDAction.NONE){
heldAction2 = action; heldAction2 = action;
@ -338,7 +341,7 @@ public class CellSelector extends ScrollArea {
if (newLeftStick != leftStickAction){ if (newLeftStick != leftStickAction){
if (leftStickAction == SPDAction.NONE){ if (leftStickAction == SPDAction.NONE){
heldDelay = 0.05f; heldDelay = INITIAL_DELAY;
Dungeon.hero.resting = false; Dungeon.hero.resting = false;
} else if (newLeftStick == SPDAction.NONE && heldDelay > 0f){ } else if (newLeftStick == SPDAction.NONE && heldDelay > 0f){
heldDelay = 0f; heldDelay = 0f;