Exemplo n.º 1
1
        protected bool leftToRight = false; // Final boss can fire bolts left and right

        #endregion Fields

        #region Constructors

        public Bolt(Texture2D textureImage, Point sheetSize, Vector2 position, int millisecondsPerFrame, bool leftToRight, Rectangle window, ExplosionManager explosionManager)
            : base(textureImage, sheetSize,  position, Vector2.Zero, millisecondsPerFrame, window, explosionManager,null)
        {
            this.health = 100f;
            this.leftToRight = leftToRight;
            this.energyToLose = health / (sheetSize.Y * sheetSize.X);
        }
Exemplo n.º 2
0
        protected int timeTillNextRBolt = 4000; // Electricity bolt ( right )

        #endregion Fields

        #region Constructors

        public FinalBoss(Texture2D textureImage, Texture2D pulseCannonTex, Texture2D boltCannonTex, Texture2D defendersPlatformTex, Texture2D defenderTex, Texture2D pulseTex, Texture2D boltTex, Player player, Rectangle window, ExplosionManager explosionManager, SoundBank soundBank)
            : base(textureImage, new Point(1, 1),  new Vector2(window.Width / 2f, window.Height + 400), Vector2.Zero, window, explosionManager, soundBank)
        {
            this.pulseCannonTex = pulseCannonTex;
            this.boltCannonTex = boltCannonTex;
            this.defendersPlatformTex = defendersPlatformTex;
            this.defenderTex = defenderTex;
            this.pulseTex = pulseTex;
            this.boltTex = boltTex;

            this.player = player;

            this.explosionDamage = 200f;
            this.explosionRadius = 300f;
            this.scoreOnDeath = 3000;
            this.health = 14000;
            this.materialDensity = 10f;

            this.rotation = (float)Math.PI;

            boltR = new Bolt(boltTex, new Point(1, 4), position - new Vector2(230 + 105 + 10, 15), 60, false, window, explosionManager);
            boltL = new Bolt(boltTex, new Point(1, 4), position + new Vector2(230 + 105 + 10, -15), 60, true, window, explosionManager);

            this.side = Side.Aliens;

            soundBank.PlayCue("FinalBossFlyBy");
        }
Exemplo n.º 3
0
        public Bullet(Texture2D textureImage, Vector2 position, Vector2 speed, Rectangle window, ExplosionManager explosionManager, SoundBank soundBank)
            : base(textureImage, new Point(1, 1),  position, speed, window, explosionManager, soundBank)
        {
            this.explosionDamage = 20f;
            this.explosionRadius = 5f;
            this.scoreOnDeath = 0;
            this.health = 20;

            this.side = Side.Player;
        }
Exemplo n.º 4
0
        public Missile(Texture2D textureImage, Point sheetSize,Vector2 position, Vector2 speed, float rotation, Rectangle window, ExplosionManager explosionManager, SoundBank soundBank)
            : base(textureImage, sheetSize,  position, speed, window, explosionManager, soundBank)
        {
            this.rotation = rotation;

            this.explosionDamage = 150f;
            this.explosionRadius = 300f;

            this.currentFrame = new Point(sheetSize.X - 1, 0);

            this.side = Side.Player;
        }
Exemplo n.º 5
0
        public Sprite(Texture2D textureImage, Point sheetSize, Vector2 position, Vector2 speed, int millisecondsPerFrame, Rectangle window, ExplosionManager explosionManager, SoundBank soundBank)
        {
            this.textureImage = textureImage;
            this.sheetSize = sheetSize;
            this.frameSize = new Point(textureImage.Width / sheetSize.X, textureImage.Height / sheetSize.Y);
            this.position = position;
            this.speed = speed;
            this.millisecondsPerFrame = millisecondsPerFrame;

            this.window = window;
            this.explosionManager = explosionManager;
            this.soundBank = soundBank;
        }
Exemplo n.º 6
0
        public Pulse(Texture2D textureImage, Vector2 position, Vector2 target, Rectangle window, ExplosionManager explosionManager)
            : base(textureImage, new Point(1, 1),position, Vector2.Zero, window, explosionManager,null)
        {
            float m = (position.Y - target.Y) / (position.X - target.X);
            double a = Math.Atan(m) - Math.PI / 2f;

            if (target.X < position.X) a += (float)Math.PI;

            // Pulse speed must be constant, it has nothing to do with how far the player is
            speed = new Vector2(-(float)Math.Sin(a), (float)Math.Cos(a)) * 8;

            this.side = Side.Aliens;
        }
Exemplo n.º 7
0
        protected float timeTillNextFlop = 0; // To limit switching direction while using keyboard to play

        #endregion Fields

        #region Constructors

        public Player(Texture2D textureImage, Point sheetSize,Texture2D bulletTex, Texture2D missileTex, Vector2 position, float health, float maxEngineTorque, int bulletFireDelay, ControlMethod controlMethod, Rectangle window, ExplosionManager explosionManager, SoundBank soundBank)
            : base(textureImage, sheetSize, position, Vector2.Zero, window, explosionManager,soundBank)
        {
            this.bulletTex = bulletTex;
            this.missileTex = missileTex;

            this.health = this.maxHealth = health;
            this.maxEngineTorque = this.engineTorque = maxEngineTorque;
            this.initBulletFireDelay = bulletFireDelay;

            this.explosionDamage = 20f;
            this.explosionRadius = 10f;
            this.materialDensity = 10f;

            this.controlMethod = controlMethod;

            this.side = Side.Player;
        }
Exemplo n.º 8
0
        protected Rectangle window; // The window to perform OutOfBounds check with

        #endregion Fields

        #region Constructors

        public EnemyManager(Texture2D invaderTex, Texture2D motherShipTex, Texture2D droneTex, Texture2D pulseTex, Texture2D finalBossTex, Texture2D boltTex, Texture2D boltCannonTex, Texture2D pulseCannonTex, Texture2D defendersPlatformTex, Player player, Rectangle window, ExplosionManager explosionManager, SoundBank soundBank)
        {
            this.invaderTex = invaderTex;

            this.motherShipTex = motherShipTex;
            this.droneTex = droneTex;
            this.pulseTex = pulseTex;

            this.finalBossTex = finalBossTex;
            this.boltTex = boltTex;
            this.boltCannonTex = boltCannonTex;
            this.pulseCannonTex = pulseCannonTex;
            this.defendersPlatformTex = defendersPlatformTex;

            this.player = player;

            this.window = window;

            this.explosionManager = explosionManager;
            this.soundBank = soundBank;
        }
Exemplo n.º 9
0
        public MotherShip(Texture2D textureImage, Texture2D droneTex, Texture2D pulseTex, Vector2 position, Player player, Rectangle window, ExplosionManager explosionManager, SoundBank soundBank)
            : base(textureImage, new Point(1, 1), position, Vector2.Zero, window, explosionManager, soundBank)
        {
            this.droneTex = droneTex;
            this.pulseTex = pulseTex;

            this.side = Side.Aliens;

            this.player = player;

            speed = new Vector2(Math.Sign(player.GetPosition.X - this.position.X) * Math.Abs(player.GetPosition.X - this.position.X) / 200f,
                            Math.Sign(player.GetPosition.Y - this.position.Y) * Math.Abs(player.GetPosition.Y - this.position.Y) / 200f);

            // Calculating rotation
            double m = (position.Y - player.GetPosition.Y) / (position.X - player.GetPosition.X);
            rotation = (float)(Math.Atan(m) - Math.PI / 2f);
            if (player.GetPosition.X > position.X) rotation -= (float)Math.PI;

            this.explosionDamage = 200f;
            this.explosionRadius = 40f;
            this.scoreOnDeath = 400;
            this.health = 200;
            this.materialDensity = 40f;
        }
Exemplo n.º 10
0
 public Sprite(Texture2D textureImage, Point sheetSize, Vector2 position, Vector2 speed, Rectangle window, ExplosionManager explosionManager, SoundBank soundBank)
     : this(textureImage, sheetSize,  position, speed, defualtMillisecondsPerFrame, window, explosionManager, soundBank)
 {
 }