// Update is called once per frame
    void Update()
    {
        //prevents accidental touches on screen as soon as the game begins
        if (timeBeforePress > 0)
        {
            timeBeforePress -= Time.deltaTime;
        }
        if (timeBeforePress <= 0)
        {
            pressActive = true;
        }

        //touch controls
        if (Input.touchCount != 0 && Input.GetTouch(0).phase == TouchPhase.Began)
        {
            Touch      touch = Input.touches[0];
            Ray        ray   = Camera.main.ScreenPointToRay(touch.position);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, 100f))
            {
                Debug.Log(hit.transform.gameObject.name);
                //tells the ball to shoot upwards if the top half of the screen is touched
                if (hit.transform.gameObject.name == "Button Top")
                {
                    Ball_Spawner.SpawnUp();
                }
                //tells the ball to shoot downward if the bottom half of the screen is touched
                if (hit.transform.gameObject.name == "Button Bottom")
                {
                    Ball_Spawner.SpawnDown();
                }
            }
        }
        //mouse controls
        if (Input.GetMouseButtonDown(0) && pressActive == true && Input.touchCount == 0)
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, 100f))
            {
                Debug.Log(hit.transform.gameObject.name);
                //click on top half shoots ball up
                if (hit.transform.gameObject.name == "Button Top")
                {
                    Ball_Spawner.SpawnUp();
                }
                //click on bottom half shoots ball down
                if (hit.transform.gameObject.name == "Button Bottom")
                {
                    Ball_Spawner.SpawnDown();
                }
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        // Setting Variables
        Whiteness         = true;
        colorTimer        = 0;
        spawnDarkBall     = false;
        spawnLightBall    = true;
        balls_Left        = 3;
        score             = 0;
        ball_Speed        = 2.5f;
        speed_Incrementer = 0.01f;
        game_Over         = false;

        // Calling functions
        UpdateBalls();
        UpdateScore();
        InvokeRepeating("blockSpeedUpdater", 1, 1);
        InvokeRepeating("colorTimerIncrementor", 1, 1);

        // Assign Ball Spawner Script
        ballSpawnerObject = GameObject.FindWithTag("Ball_Spawner");
        if (ballSpawnerObject != null)
        {
            ballSpawner = ballSpawnerObject.GetComponent <Ball_Spawner> ();
        }

        // Assign Bottom Block Spawner Script
        bottomBlockSpawnerObject = GameObject.FindWithTag("Bottom_Block_Spawner");
        if (bottomBlockSpawnerObject != null)
        {
            bottomBlockSpawner = bottomBlockSpawnerObject.GetComponent <Bottom_Block_Spawner> ();
        }

        // Assign Top Block Spawner Script
        topBlockSpawnerObject = GameObject.FindWithTag("Top_Block_Spawner");
        if (topBlockSpawnerObject != null)
        {
            topBlockSpawner = topBlockSpawnerObject.GetComponent <Top_Block_Spawner> ();
        }

        ballScriptObject = GameObject.FindWithTag("Ball");
        if (ballScriptObject != null)
        {
            ballScript = ballScriptObject.GetComponent <Ball_Script> ();
        }
    }
    // Use this for initialization
    void Start()
    {
        // Setting Variables
        Whiteness = true;
        colorTimer = 0;
        spawnDarkBall = false;
        spawnLightBall = true;
        balls_Left = 3;
        score = 0;
        ball_Speed = 2.5f;
        speed_Incrementer = 0.01f;
        game_Over = false;

        // Calling functions
        UpdateBalls ();
        UpdateScore ();
        InvokeRepeating ("blockSpeedUpdater", 1, 1);
        InvokeRepeating ("colorTimerIncrementor", 1, 1);

        // Assign Ball Spawner Script
        ballSpawnerObject = GameObject.FindWithTag ("Ball_Spawner");
        if (ballSpawnerObject != null) {
            ballSpawner = ballSpawnerObject.GetComponent <Ball_Spawner> ();
        }

        // Assign Bottom Block Spawner Script
        bottomBlockSpawnerObject = GameObject.FindWithTag ("Bottom_Block_Spawner");
        if (bottomBlockSpawnerObject != null) {
            bottomBlockSpawner = bottomBlockSpawnerObject.GetComponent <Bottom_Block_Spawner> ();
        }

        // Assign Top Block Spawner Script
        topBlockSpawnerObject = GameObject.FindWithTag ("Top_Block_Spawner");
        if (topBlockSpawnerObject != null) {
            topBlockSpawner = topBlockSpawnerObject.GetComponent <Top_Block_Spawner> ();
        }

        ballScriptObject = GameObject.FindWithTag ("Ball");
        if (ballScriptObject != null) {
            ballScript = ballScriptObject.GetComponent <Ball_Script> ();
        }
    }