// we want to spawn them slowly at first and more over time, randomly on the screen (left to right)
    void Update()
    {
        // cooldown
        if (spawnCooldown > 0)
        {
            spawnCooldown -= Time.deltaTime;
        }

        if (CanSpawn)
        {
            spawnCooldown = spawnRate;
            spawnedCount++;

            int   leftOrRight = Random.Range(1, 3);
            float randomX     = (float)leftOrRight == 1 ? spawnX : spawnX * -1;

            Transform newMosquito = (Transform)Instantiate(spawneePrefab, new Vector3(randomX, spawnY, 0f), transform.rotation);
            newMosquito.parent = transform;
            AmebaMoveScript ams      = newMosquito.GetComponent <AmebaMoveScript>();
            float           newSpeed = ams.speed + spawnedCount * speedConstant;
            ams.speed = leftOrRight == 1 ? newSpeed * -1 : newSpeed;
        }
    }
    void OnTriggerEnter2D(Collider2D collider)
    {
        //Debug.Log("hit");

        // Collision with enemy
        EnemyScript enemy = collider.gameObject.GetComponent <EnemyScript>();

        if (enemy != null)
        {
            // Kill the mosquito enemy
            MosquitoHealthScript enemyHealth = enemy.GetComponent <MosquitoHealthScript>();
            if (enemyHealth != null)
            {
                enemyHealth.Damage(attackDamage);
            }
        }

        //collide with ameba
        AmebaMoveScript ameba = collider.gameObject.GetComponent <AmebaMoveScript>();

        if (ameba != null)
        {
            Debug.Log("ameba");

            switch (ameba.type)
            {
            case 1:
                Debug.Log("Heal Powerup");
                GameObject.Find("Scripts").GetComponent <HealthScript>().DamageBody(-amebaHealAmount);
                break;

            case 2:
                Debug.Log("Double Width Powerup");
                float powerupWidth = gameObject.transform.localScale.x * widthSizeScale;
                if (powerupWidth > 15)
                {
                    powerupWidth = 15.0f;
                }
                gameObject.transform.localScale = new Vector3(powerupWidth, gameObject.transform.localScale.y, gameObject.transform.localScale.z);
                sizePowerupCooldown             = sizePowerUpTimeLength;
                big = true;
                break;
            }
            // play noise

            AudioSource[] sounds     = GetComponents <AudioSource>();
            AudioSource   deathNoise = sounds[ameba.type - 1];
            deathNoise.Play();

            Destroy(ameba.gameObject);
        }

        //collide with egg
        EggScript egg = collider.gameObject.GetComponent <EggScript>();

        if (egg != null)
        {
            Debug.Log("blast off egg");
            egg.HitByPlayer();
        }

        // attack phase 2 boss
        KingMosquitoScript km = collider.gameObject.GetComponent <KingMosquitoScript>();

        if (km != null)
        {
            km.HitByPlayer(attackDamage);
        }
    }