Beispiel #1
0
 public Boss(Healthbar healthbar, Texture2D spriteSheet, SoundEffect defeatSound, AnimationState[] animations, int frameWidth, int frameHeight, Vector2 loc, int speed, int mobWidth, int mobHeight, Weapon[] weapons) : base(spriteSheet, animations, frameWidth, frameHeight, loc, speed, mobWidth, mobHeight, MAX_HEALTH)
 {
     this.weapons     = weapons;
     this.defeatSound = defeatSound;
     random           = new Random();
     sideSpeed        = random.Next(MIN_SIDE_SPEED, MAX_SIDE_SPEED);
     this.healthbar   = healthbar;
 }
Beispiel #2
0
        public static void LoadContent(Game1 game)
        {
            mobBulletTexture = game.Content.Load <Texture2D>("Bullet");
            Texture2D tex = game.Content.Load <Texture2D>("BossSpriteSheet");

            AnimationState[] animations = new AnimationState[1];
            animations[0]      = new AnimationState(AnimationState.AnimationType.Idle, 0, 0, 4, 100f);
            noShootAnimations  = animations;
            shootAnimations    = new AnimationState[1];
            shootAnimations[0] = new AnimationState(AnimationState.AnimationType.Idle, 1, 0, 4, 100f);
            BossWeapon[] bossWeapons = new BossWeapon[2];
            SoundEffect  sound       = game.Content.Load <SoundEffect>("GameSounds/bossshoot");

            bossShoot      = sound;
            bossWeapons[0] = new BossWeapon(mobBulletTexture, sound);
            bossWeapons[1] = new BossWeapon(mobBulletTexture, sound);
            Healthbar health = new Healthbar(game.Content.Load <Texture2D>("healthbar"), 50, 10, Game1.WIDTH / 2 - 100, 50);

            LargeBoss            = new Boss(health, tex, game.Content.Load <SoundEffect>("GameSounds/bossdefeat"), animations, 88, 89, new Vector2(Game1.WIDTH / 4 - (90 * 4) / 2, -80 * 4), 1, 90 * 4, 80 * 4, bossWeapons);
            basicEnemyTexture    = game.Content.Load <Texture2D>("EnemySpriteSheet");
            BasicMob             = new BasicMob(basicEnemyTexture, noShootAnimations, 43, 42, new Vector2(0, 0), 5, 45, 40);
            basicShootingTexture = game.Content.Load <Texture2D>("EnemySpriteSheet");
            sound    = game.Content.Load <SoundEffect>("GameSounds/playershoot");
            mobShoot = sound;
            Weapon shootWeapon = new MobWeapon(mobBulletTexture, sound);

            BasicShootingMob = new ShootingMob(basicEnemyTexture, noShootAnimations, 43, 42, new Vector2(0, 0), 5, 45, 40, shootWeapon);
            random           = new Random();

            spawnLocations = new List <WaveLocation>();

            MobSpawn[] spawns  = new MobSpawn[4];
            int        spacing = (Game1.WIDTH / 2 - BasicMob.MobWidth * 4) / 4;
            int        offset  = (Game1.WIDTH / 4 - (spacing * 2) + BasicMob.MobWidth / 2);

            for (int i = 0; i < spawns.Length; i++)
            {
                spawns[i] = new MobSpawn(new Vector2(spacing * i + offset, -BasicMob.MobHeight), 0f, MobType.FastMob);
            }
            spawnLocations.Add(new WaveLocation("The Quad", spawns));

            spawns  = new MobSpawn[8];
            spacing = BasicMob.MobWidth;
            offset  = (Game1.WIDTH / 2 - BasicMob.MobWidth * 4);
            for (int i = 0; i < spawns.Length / 2; i++)
            {
                spawns[i] = new MobSpawn(new Vector2(spacing * i, -BasicMob.MobHeight), 0f, MobType.ShootMob);
            }
            for (int i = spawns.Length / 2; i < spawns.Length; i++)
            {
                spawns[i] = new MobSpawn(new Vector2(spacing * (i - 4) + offset, -BasicMob.MobHeight), 0f, MobType.FastMob);
            }
            spawnLocations.Add(new WaveLocation("Double Trouble", spawns));

            spawns  = new MobSpawn[4];
            spacing = (Game1.WIDTH / 2 - BasicMob.MobWidth * 4) / 4;
            offset  = (Game1.WIDTH / 4 - (spacing * 2) + BasicMob.MobWidth / 2);
            for (int i = 0; i < spawns.Length; i++)
            {
                int yoff = 0;
                if (i != 0 && i != 3)
                {
                    yoff      = -BasicMob.MobHeight;
                    spawns[i] = new MobSpawn(new Vector2(spacing * i + offset, -BasicMob.MobHeight + yoff), 0f, MobType.BasicMob);
                }
                else
                {
                    spawns[i] = new MobSpawn(new Vector2(spacing * i + offset, -BasicMob.MobHeight + yoff), 0f, MobType.ShootMob);
                }
            }
            spawnLocations.Add(new WaveLocation("The Quad Offset", spawns));

            spawns  = new MobSpawn[(Game1.WIDTH / 2) / BasicMob.MobWidth];
            spacing = BasicMob.MobWidth;
            offset  = (Game1.WIDTH / 2 - ((Game1.WIDTH / 2) / BasicMob.MobWidth) * BasicMob.MobWidth) / 2;
            for (int i = 0; i < spawns.Length; i++)
            {
                if (i % 3 != 0)
                {
                    spawns[i] = new MobSpawn(new Vector2(spacing * i + offset, -BasicMob.MobHeight), 0f, MobType.BasicMob);
                }
                else
                {
                    spawns[i] = new MobSpawn(new Vector2(spacing * i + offset, -BasicMob.MobHeight), 0f, MobType.ShootMob);
                }
            }
            spawnLocations.Add(new WaveLocation("The Wall", spawns));

            spawns  = new MobSpawn[((Game1.WIDTH / 2) / BasicMob.MobWidth) - 8];
            spacing = BasicMob.MobWidth;
            offset  = (Game1.WIDTH / 2 - ((Game1.WIDTH / 2) / BasicMob.MobWidth) * BasicMob.MobWidth) / 2 + BasicMob.MobWidth * 4;
            for (int i = 0; i < spawns.Length; i++)
            {
                spawns[i] = new MobSpawn(new Vector2(spacing * i + offset, -BasicMob.MobHeight), 0f, MobType.ShootMob);
            }
            spawnLocations.Add(new WaveLocation("Firing Squad", spawns));

            spawns  = new MobSpawn[4];
            spacing = Game1.WIDTH / 2 - BasicMob.MobWidth;
            offset  = 0;
            for (int i = 0; i < spawns.Length / 2; i++)
            {
                spawns[i] = new MobSpawn(new Vector2(spacing * i, -BasicMob.MobHeight), 180f * i, MobType.SideMob);
            }
            for (int i = spawns.Length / 2; i < spawns.Length; i++)
            {
                spawns[i] = new MobSpawn(new Vector2(spacing * (i - 2), -BasicMob.MobHeight * 2), 180f * (i - 2), MobType.SideMob);
            }
            spawnLocations.Add(new WaveLocation("Sidewinder", spawns));
        }