Disable input.getkeydown() in a specific region of my game.

Hello Im new in Unity.I am going to develop a game. There is two sprite in my game window, one is top other is bottom and they are randomly looped. when I touch the top sprite it will execute a action and if I touch lower portion it will not work. Im trying but there is a problem when I touch in top or bottom it always execute the action. How can I turn off the executing action in bottom??

I want the didFlap(in below code) will true only when the top portion is clicked/touched.

using UnityEngine;
using System.Collections;

public class BirdMovement : MonoBehaviour {

public float flapSpeed    = 100f;
public float forwardSpeed = 1f;

bool didFlap = false;

Animator animator;

public bool dead = false;
float deathCooldown;

public bool godMode = false;

public GameObject gameEndmessage;

public AudioClip flapSound;
public AudioClip hitSound;

public static bool		soundPlay = true;

// Use this for initialization
void Start () {

	animator = transform.GetComponentInChildren<Animator>();

	if(animator == null) {
		Debug.LogError("Didn't find animator!");
	}
}

// Do Graphic & Input updates here
void Update() {
	if(!didFlap){
		if (Input.GetKeyDown(KeyCode.Escape)) 
			Application.LoadLevel(0);
	}
	if(dead) {
		deathCooldown -= Time.deltaTime;

		if(deathCooldown <= 0) {
			if (Input.GetKeyDown(KeyCode.Escape)) 
				Application.LoadLevel(0);

			if(Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0) ) {
				//Application.LoadLevel( Application.loadedLevel );
			}
		}
	}
	else {
		if(Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0) ) {
			didFlap = true;
		}
	}
}


// Do physics engine updates here
void FixedUpdate () {

	if(dead)

		return;

	rigidbody2D.AddForce( Vector2.right * forwardSpeed );

	if(didFlap) {
		rigidbody2D.AddForce( Vector2.up * flapSpeed );
		animator.SetTrigger("DoFlap");
		if(soundPlay){
			audio.clip=flapSound;
			audio.Play ();
		}
	

		didFlap = false;
	}

	if(rigidbody2D.velocity.y > 0) {
		transform.rotation = Quaternion.Euler(0, 0, 0);
	}
	else {
		float angle = Mathf.Lerp (0, -90, (-rigidbody2D.velocity.y / 3f) );
		transform.rotation = Quaternion.Euler(0, 0, angle);
	}
}

void OnCollisionEnter2D(Collision2D collision) {
	//Debug.Log("Yes Bird Down");
	if(godMode)
		return;

	if(soundPlay){
		audio.clip=hitSound;
		audio.Play ();
	}

	animator.SetTrigger("Death");
	dead = true;
	deathCooldown = 0.5f;
	gameEndmessage.SetActive (true);

}

void SoundButton(){
	if (soundPlay) {
					soundPlay = false;
			} else {
		soundPlay=true;
			}
}

void GameRestart(){
	Application.LoadLevel(1);
}

}

Don’t use Input.GetMouseButtonDown() for this. Attach a box collider to the top sprite and one to the bottom sprite, then add a script to each sprite with a “OnMouseDown()” event in it. This will also handle touch events for mobile. In the OnMouseDown() event, set a global flag indicating which sprite was clicked. Every time they click a sprite, it enters OnMouseDown() and you test that global flag, which might be used to indicate if the top or bottom or none sprite is active, and then you ignore it if clicking the bottom sprite while the top sprite is active, or vice versa.

public enum SelectedSprite {TOP, BOTTOM, NONE};
public SelectedSprite thisSpriteType;
private static SelectedSprite currentSprite = SelectedSprite.NONE;

public void OnMouseDown() {
    if (currentSprite == SelectedSprite.NONE) {
        // Start your animation;
        currentSprite = thisSpriteType;
    } else {
      if (currentSprite == thisSpriteType) {
        // Stop the animation
        currentSprite = SelectedSprite.NONE;
      }
    }
}

This is just an example psuedocode (though it may compile if you try). This would start animating the top sprite when you click the top sprite once. Then you click the bottom sprite and it does nothing. Click the top sprite again, and it stops animation, and now you can click either the top or the bottom sprite. In this code, you would assign this in a single script to both the top and bottom sprites (both having their own colliders). In the top sprite, you would set the value of thisSpriteType to TOP in the inspector, and set the bottom one to BOTTOM.