# CS0106, how would i solve this

Here is the code

``````public class PlayerController : MonoBehaviour
{
public float moveSpeed;

private bool isMoving;

private Vector2 input;

private Animator animator;

private void Awake()
{
animator = GetComponent<Animator>();
}

private void Update()
{
if (!isMoving)
{
input.x = Input.GetAxisRaw("Horizontal");
input.y = Input.GetAxisRaw("Vertical");

if (input.x != 0) input.y = 0;

if (input != Vector2.zero)
{
animator.SetFloat("moveX", input.x);
animator.SetFloat("moveY", input.y);

Vector3 targetPos = transform.position;
targetPos.x += input.x * moveSpeed * Time.deltaTime;
targetPos.y += input.y * moveSpeed * Time.deltaTime;

if (IsWalkable(targetPos)) ;

StartCoroutine(Move(targetPos));
}

}

animator.SetBool("isMoving", isMoving);

if (Input.GetKeyDown(KeyCode.Z))
Interact();
}

void Interact()
{
var facingDir = new Vector3(animator.GetFloat("moveX"), animator.GetFloat("moveY"));
var interactPos = transform.position + facingDir;

//Debug.DrawLine(transform.position, interactPos, Color.red, 1f);

var collider = Physics2D.OverlapCircle(interactPos, 0.2f, interactableLayer);
if (collider != null)
{
collider.GetComponent<Interactable>()?.Interact();
}

IEnumerator Move(Vector3 targetPos)
{
isMoving = true;

while ((targetPos - transform.position).sqrMagnitude > Mathf.Epsilon)
{
transform.position = Vector3.MoveTowards(transform.position, targetPos, moveSpeed * Time.deltaTime);
yield return null;
}
transform.position = targetPos;

isMoving = false;
}

private bool IsWalkable(Vector3 targetPos)
{
// Check for collider overlaps within a circle centered at targetPos with a radius of 0.2f
// solidObjectsLayer and interactableLayer are assumed to be defined elsewhere in the class
if (Physics2D.OverlapCircle(targetPos, 0.2f, solidObjectsLayer | interactableLayer) != null)
{
// If an overlap is found, indicating that the position is not walkable, return false
return false;
}
// If no overlap is found, return true indicating that the position is walkable
return true;
}
}
}

``````

The error is saying that `private` and `public` donâ€™t go with the `IsWalkable` `bool`.

You are defining `private bool IsWalkable` from inside of the `void Interact` function. While this is technically allowed in C#, I expect this is not what you intended.