示例#1
0
        /*
         * fireBullet(Vector2 dukePosition)
         * parameters: setBullet
         * Purpose: allows mainclass to set bulletReady variable after spawning a bullet object, used as part of the enemy fire control system.
         * Enemy bullet depends on enemy class.
         * */
        public override void fireBullet(Vector2 dukePosition)
        {
            if (dukePosition.X < this.position.X)//determines if character faces left or right
            {
                rotation = 3.9f;
            }
            else
            {
                rotation = 5.45f;
            }
            bullet = new EnemyBullet(bulletTexture);

            bullet.position    = this.position;
            bullet.position.X += spriteWidth / 2;
            bullet.position.Y += this.mainSpriteSheet[0].Height / 4;
            bullet.velocity    = new Vector2(
                (float)Math.Cos(this.rotation),
                (float)Math.Sin(this.rotation)) * 10.0f;
        }
示例#2
0
        /*
         * fireBullet(Vector2 dukePosition)
         * parameters: setBullet
         * Purpose: allows mainclass to set bulletReady variable after spawning a bullet object, used as part of the enemy fire control system.
         * Enemy bullet depends on enemy class.
         * */
        public override EnemyBullet fireBullet(Vector2 dukePosition, Vector2 dukeVelocity)
        {
            bullet             = new EnemyBullet(bulletTexture);
            bullet.rotation    = (float)(Math.PI * .3f);//lowerRight
            bullet.position    = this.position;
            bullet.position.X += spriteWidth / 2;
            bullet.position.Y += this.mainSpriteSheet[0].Height / 4;
            bullet.velocity    = this.velocity;


            //determining velocity to go from alien to the pony
            bullet.velocity = new Vector2(
                (float)Math.Cos(bullet.rotation) * 2f,
                (float)Math.Sin(bullet.rotation)) * 10.0f;
            bullet.visible = true;

            this.setBulletReady(false);
            return(bullet);
        }
示例#3
0
        /*
         * fireBullet(Vector2 dukePosition)
         * parameters: setBullet
         * Purpose: allows mainclass to set bulletReady variable after spawning a bullet object, used as part of the enemy fire control system.
         * Enemy bullet depends on enemy class.
         * */
        public override EnemyBullet fireBullet(Vector2 dukePosition, Vector2 dukeVelocity)
        {
            rotation = 5.45f;
            bullet   = new EnemyBullet(bulletTexture);

            bullet.position    = this.position;
            bullet.position.X += spriteWidth * 2;
            bullet.position.Y += this.mainSpriteSheet[0].Height / 4;
            bullet.velocity    = this.velocity;


            //determining velocity to go from alien to the pony
            bullet.velocity.X = -8f;
            bullet.velocity.Y = 0f;



            this.setBulletReady(false);
            return(bullet);
        }