void Move(Vector2Int newPosition)
    {
        if (newPosition.x > 0)
        {
            GetComponent <SpriteRenderer>().flipX = true;
        }
        else
        {
            GetComponent <SpriteRenderer>().flipX = false;
        }

        // Calculates the projected position
        newPosition.x += gridPosition.x;
        newPosition.y += gridPosition.y;

        // Checks if player is move is legal
        if (newPosition.x >= 0 && newPosition.x < GroundGrid.gridSize.x && newPosition.y >= 0 && newPosition.y < GroundGrid.gridSize.y)
        {
            GroundTile newTile = grid.gameGrid[newPosition.x, newPosition.y].GetComponent <GroundTile>();
            if (newTile.currentDurability > 0)
            {
                gridPosition = newPosition;
                canMove      = false;

                if (newTile.log != null)
                {
                    Destroy(newTile.log);
                    IncrMaterials();
                }

                // Detect grid boundaries and broken tiles
            }
            else
            {
                if (materialsCount > 0)                // If the player has enough materials, repair the target tile
                {
                    IncrMaterials(false);
                    sound.PlayOneShot(repairSound);
                    newTile.Repair(new Vector3(gridPosition.x, gridPosition.y, 0));
                }
                grid.availableTiles.Add(newTile);
                canMove = false;
            }
        }
    }