示例#1
0
        public Enemy(AnimatedTexture spriteA, AnimatedTexture spriteD, Texture2D loadedBullet,
            int numBullets, float scale, Vector2 initialPosition,
            int mpattern, int fpattern, bool foodDrop, bool left)
        {
            // Assign essential textures.
            spriteAlive = spriteA;
            spriteDead = spriteD;
            width = (int)((spriteA.myTexture.Width / (spriteA.framecount / spriteA.rows)) * spriteA.Scale);
            height = (int)((spriteA.myTexture.Height / spriteA.rows) * spriteA.Scale);
            rotation = 0.0f;            // No initial rotation.
            animating = true;
            alive = true;         // Enemies start alive when they are added to the enemy list.
            maxBullets = numBullets;
            position = initialPosition;
            center = new Vector2(width / 2, height / 2);      // Center value assigned.
            movePattern = mpattern;
            firePattern = fpattern;
            dropsFood = foodDrop;
            //            time = new fireTimer();
            enemyTime = new Timer();
            isLeft = left;

            // Save textures for copying enemies.
            aliveTex = spriteA.myTexture;
            deadTex = spriteD.myTexture;
            bulletText = loadedBullet;

            // Initializae new array of bullets.
            bullets = new Bullet[maxBullets];
            for (int i = 0; i < maxBullets; i++)
            {
                bullets[i] = new Bullet(loadedBullet, scale);
            }
            rand = new Random();
        }
示例#2
0
        public EnemyList(ContentManager content)
        {
            enemies = new Enemy[NUMBER_OF_ENEMIES];

            AnimatedTexture rockAlive = new AnimatedTexture(content.Load<Texture2D>("Enemies\\rock_alive"), 1, 1, Vector2.Zero, 0.0f, 1.0f, 0.2f);
            AnimatedTexture rockDead = new AnimatedTexture(content.Load<Texture2D>("Enemies\\rock_anim1"), 35, 30, Vector2.Zero, 0.0f, 1.0f, 0.2f);
            Texture2D rockBullet = content.Load<Texture2D>("Bullets\\rock_bullet");
            ERock rock = new ERock(rockAlive, rockDead, rockBullet, 5, 10,
                .3f, Vector2.Zero, Vector2.Zero, 0, 0, false, false);

            AnimatedTexture lionAlive = new AnimatedTexture(content.Load<Texture2D>("Enemies\\lion_alive"), 1, 1, Vector2.Zero, 0.0f, .75f, 0.2f);
            AnimatedTexture lionDead = new AnimatedTexture(content.Load<Texture2D>("Enemies\\lion_death"), 35, 30, Vector2.Zero, 0.0f, .75f, 0.2f, 7);
            Texture2D lionBullet = content.Load<Texture2D>("Bullets\\lion_bullet");

            ELion lion = new ELion(lionAlive, lionDead, lionBullet, 10, 20,
                .2f, Vector2.Zero, Vector2.Zero, 0, 0, false, false);

            AnimatedTexture bflyAlive = new AnimatedTexture(content.Load<Texture2D>("Enemies\\butterflyfly"), 10, 30, Vector2.Zero, 0.0f, 1.5f, 0.2f, 5);
            AnimatedTexture bflyDead = new AnimatedTexture(content.Load<Texture2D>("Enemies\\butterflydeath"), 35, 20, Vector2.Zero, 0.0f, 1.5f, 0.2f, 7);
            Texture2D bflyBullet = content.Load<Texture2D>("Bullets\\bfly_bullet");

            EBfly bfly = new EBfly(bflyAlive, bflyDead, bflyBullet, 20, 20,
                .9f, Vector2.Zero, Vector2.Zero, 0, 0, false, false);

            AnimatedTexture mBossAlive = new AnimatedTexture(content.Load<Texture2D>("Enemies\\minibossfly"), 25, 30, Vector2.Zero, 0.0f, 1.0f, 0.75f, 5);
            AnimatedTexture mBossDead = new AnimatedTexture(content.Load<Texture2D>("Enemies\\minibossdeath"), 40, 30, Vector2.Zero, 0.0f, 1.0f, 0.75f, 8);
            Texture2D mBossBullet = content.Load<Texture2D>("Bullets\\fireball0001");

            EMiniboss miniboss1 = new EMiniboss(mBossAlive, mBossDead, mBossBullet, 100, 500,
                .6f, Vector2.Zero, Vector2.Zero, 0, 0, false, false);

            AnimatedTexture batAlive = new AnimatedTexture(content.Load<Texture2D>("Enemies\\batfly"), 10, 30, Vector2.Zero, 0.0f, 1.0f, 0.2f, 5);
            AnimatedTexture batDead = new AnimatedTexture(content.Load<Texture2D>("Enemies\\batdeath"), 35, 30, Vector2.Zero, 0.0f, 1.0f, 0.2f, 7);
            Texture2D batBullet = content.Load<Texture2D>("Bullets\\bat_bullet");

            EBat bat = new EBat(batAlive, batDead, batBullet, 15, 100,
                .6f, Vector2.Zero, Vector2.Zero, 0, 0, false, false);

            AnimatedTexture eyeAlive = new AnimatedTexture(content.Load<Texture2D>("Enemies\\iSpikefly"), 75, 30, Vector2.Zero, 0.0f, 1.0f, 0.2f, 15);
            AnimatedTexture eyeDead = new AnimatedTexture(content.Load<Texture2D>("Enemies\\ispikedeath"), 35, 30, Vector2.Zero, 0.0f, 1.0f, 0.2f, 7);
            Texture2D eyeBullet = content.Load<Texture2D>("Bullets\\eye_bullet");

            EEye eye = new EEye(eyeAlive, eyeDead, eyeBullet, 20, 15,
                1.0f, Vector2.Zero, Vector2.Zero, 0 , 0, false, false);

            AnimatedTexture boss1Alive = new AnimatedTexture(content.Load<Texture2D>("Enemies\\boss1fly"), 50, 30, Vector2.Zero, 0.0f, 1.0f, 0.2f, 10);
            AnimatedTexture boss1Dead = new AnimatedTexture(content.Load<Texture2D>("Enemies\\boss1death"), 55, 30, Vector2.Zero, 0.0f, 1.0f, 0.2f, 11);
            Texture2D bossBullet = content.Load<Texture2D>("Bullets\\fireball0001");

            EBossS1 stage1Boss = new EBossS1(boss1Alive, boss1Dead, bossBullet, 100, 2000,
                1.0f, Vector2.Zero, Vector2.Zero, 0, 0, false, false);

            enemies[0] = rock;
            enemies[1] = lion;
            enemies[2] = bfly;
            enemies[3] = eye;
            enemies[4] = miniboss1;
            enemies[5] = bat;
            enemies[6] = stage1Boss;
        }
示例#3
0
 // Construct new food with velocity.
 public Food(Texture2D foodImage, Vector2 position, Vector2 velocity, float value)
 {
     this.foodImage = new AnimatedTexture(foodImage, 2, 2, Vector2.Zero, 0.0f, 1.0f, .8f);
     this.position = position;
     this.velocity = velocity;
     inPlay = true;
     gaugeValue = value;
 }
示例#4
0
 public Game1()
 {
     graphics = new GraphicsDeviceManager(this);
     graphics.IsFullScreen = false;
     graphics.PreferredBackBufferHeight = height;
     graphics.PreferredBackBufferWidth = width;
     Content.RootDirectory = "Content";
     redCheckAnimated = new AnimatedTexture(Vector2.Zero,
         Rotation, Scale, Depth);
     this.IsMouseVisible = true;    
 }
示例#5
0
 public ELion2(AnimatedTexture spriteA, AnimatedTexture spriteD, Texture2D loadedBullet,
     int maxBullets, int scoreVal, float scale, Vector2 initialPosition, Vector2 initialVelocity,
     int mpattern, int fpattern, bool dropsFood, bool left)
     : base(spriteA, spriteD, loadedBullet, maxBullets, scale, initialPosition, mpattern, fpattern, dropsFood, left)
 {
     aliveTex = spriteA.myTexture;
     deadTex = spriteD.myTexture;
     bulletText = loadedBullet;
     scoreValue = scoreVal;
     velocity = initialVelocity;
     isLeft = left;
     health = 3;
     maxHealth = health;
     time = new fireTimer(new TimeSpan(0,0,0,1,500), Fire);
     time.Start();
 }
示例#6
0
 public EBfly(AnimatedTexture spriteA, AnimatedTexture spriteD, Texture2D loadedBullet,
     int maxBullets, int scoreVal, float scale, Vector2 initialPosition, Vector2 initialVelocity,
     int mpattern, int fpattern, bool dropsFood, bool left)
     : base(spriteA, spriteD, loadedBullet, maxBullets, scale, initialPosition, mpattern, fpattern, dropsFood, left)
 {
     aliveTex = spriteA.myTexture;
     deadTex = spriteD.myTexture;
     bulletText = loadedBullet;
     scoreValue = scoreVal;
     velocity = initialVelocity;
     isLeft = left;
     health = 30;
     maxHealth = health;
     time = new fireTimer(new TimeSpan(0, 0, 0, 1, 500), Fire);
     time.Start();
     enemyTime.Interval = 10000;
     enemyTime.Elapsed += new System.Timers.ElapsedEventHandler(Retreat);
     enemyTime.Start();
 }
示例#7
0
 public EBossS1(AnimatedTexture spriteA, AnimatedTexture spriteD, Texture2D loadedBullet,
     int maxBullets, int scoreVal, float scale, Vector2 initialPosition, Vector2 initialVelocity,
     int mpattern, int fpattern, bool dropsFood, bool left)
     : base(spriteA, spriteD, loadedBullet, maxBullets, scale, initialPosition, mpattern, fpattern, dropsFood, left)
 {
     aliveTex = spriteA.myTexture;
     deadTex = spriteD.myTexture;
     bulletText = loadedBullet;
     scoreValue = scoreVal;
     velocity = initialVelocity;
     isLeft = left;
     health = 500;
     maxHealth = health;
     hasHealthBar = true;
     expBullets = new ExplodingBullet[9];
     for (int i = 0; i < expBullets.Length; i++)
         expBullets[i] = new ExplodingBullet(3, Math.PI/4, 3*Math.PI/4, -1, 400, 3, loadedBullet, scale);
     time = new fireTimer(new TimeSpan(0, 0, 0, 1, 500), Fire);
     time.Start();
     isBoss = true;
 }