diff --git a/Assets/Scripts/Piece.cs b/Assets/Scripts/Piece.cs index a1e5e5c..4ba8c89 100644 --- a/Assets/Scripts/Piece.cs +++ b/Assets/Scripts/Piece.cs @@ -72,11 +72,13 @@ private void Update() private void HandleMoveInputs() { - this.moveTime = Time.time + this.moveDelay; - // Soft drop movement - if (Input.GetKey(KeyCode.S)) { - Move(Vector2Int.down); + if (Input.GetKey(KeyCode.S)) + { + if (Move(Vector2Int.down)) { + // Update the step time to prevent double movement + this.stepTime = Time.time + this.stepDelay; + } } // Left/right movement @@ -91,11 +93,8 @@ private void Step() { this.stepTime = Time.time + this.stepDelay; - // Do not move down if the player is already holding down - // otherwise it can cause a double movement - if (!Input.GetKey(KeyCode.S)) { - Move(Vector2Int.down); - } + // Step down to the next row + Move(Vector2Int.down); // Once the piece has been inactive for too long it becomes locked if (this.lockTime >= this.lockDelay) { @@ -131,6 +130,7 @@ private bool Move(Vector2Int translation) if (valid) { this.position = newPosition; + this.moveTime = Time.time + this.moveDelay; this.lockTime = 0f; // reset }