Okay, I am working on it rn the objective is the user must write or input things on the text field when if its true the movement function is invoked, the scenario seems like that. Just wanna make sure that everything goes on the button click when the input field value was true then it points to the "movement class" which contains the movement functions.
Example 2:
https://www.dropbox.com/s/6kuufabv7xcnidk/Design_phase1.1.PNG?dl=0
player movement class:
public class movementFunct1 : MonoBehaviour
{
public float speed = 5f;
private float direction = 0f;
private Rigidbody2D player;
// Start is called before the first frame update
void Start()
{
player = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
direction = Input.GetAxis("Horizontal");
if(direction >0f){
player.velocity = new Vector2(direction * speed, player.velocity.y);
}
else if(direction < 0f){
player.velocity = new Vector2(direction * speed, player.velocity.y);
}
else{
player.velocity = new Vector2(0, player.velocity.y);
}
}
}