Example #1
0
    //Shoots the bullet and sets a speed
    void Shoot(Vector2 pos, float x, float y)
    {
        GameObject  newBullet = Instantiate(bossBullet, pos, Quaternion.identity);
        spitControl script    = newBullet.GetComponent <spitControl> ();

        script.speed = new Vector2(x * speed, y * speed);
    }
Example #2
0
    //Fires the bullet
    void Fire()
    {
        GameObject  newBullet = Instantiate(bullet, new Vector2(this.gameObject.transform.position.x, this.gameObject.transform.position.y), Quaternion.identity);
        spitControl script    = newBullet.GetComponent <spitControl> ();

        script.speed = new Vector2(xSpeed, ySpeed);
        timestamp    = Time.time + fireGap;      //create delay.
    }