So I’m not sure it this is exactly where I should be posting this or not but I need some help with my code.
public bool HandleMovement(bool isWorking)
{
if (Input.GetKeyDown("a"))
{
transform.Translate(-1f, 0f, 0f);
}
if (Input.GetKeyDown("d"))
{
transform.Translate(1f, 0f, 0f);
}
return true;
}
I have this code with the return type of bool because I want to turn it off/false when it collide with another gameobject. This is my attempt:
void OnCollisionEnter2D(Collision2D coll)
{
if (coll.gameObject.tag == "Floor")
{
StopCoroutine(coroutine);
HandleMovement(false);
}
}
I’m not the best at coding yet so I’m not too sure how I get it to change to false. Thank you for any and all help!