2d Movement (forwardspeed = 0f;)

I got some questions about 2DCharacter Movement. Recently I used this script to move my character. Now the follow thing I want to do is to make the forwardSpeed = 0f; when clicked on the left side of the screen.

My first plan was to just throw 2 movement scripts on my character and assign some box colliders to them. But I just need a little bit of help on how to assign those boxcolliders to the script.

here’s the Script I use.

using UnityEngine;
using System.Collections;

public class BatMovement : MonoBehaviour {

	Vector3 velocity = Vector3.zero;
	public Vector3 gravity;
	public Vector3 FlyVelocity;
	public float maxSpeed = 5f;
	public float forwardSpeed = 2f;

	bool Flying = false;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	if(Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0)){
			Flying = true;
	}
}

	void FixedUpdate () {
		velocity.x = forwardSpeed;
		velocity += gravity * Time.deltaTime;

		if(Flying == true){
			Flying = false;
			velocity += FlyVelocity;
		}
		transform.position += velocity * Time.deltaTime;
	}
}

I could also do something like… if(OnMouseDown){forwardSpeed=0f;} But I still have to figure out how to make it work.

Try this

void Update () {
    if(Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0)){
         Flying = true;

         if (Input.GetMouseButtonDown(0) && Input.mousePosition.x < Screen.width/2) {
             // Left side of the screen
             forwardSpeed = 0.0f;
         }
    }
 }

Note I have written Input.GetMouseButtonDown(0) in the second if statement, otherwise it will work even if you press the space key. In order to set the forwardSpeed to 0.0f I supposed you can only do it with the mouse click.