示例#1
0
        private void AddEnemy()
        {
            // Create the animation object
            Animation enemyAnimation  = new Animation();
            Animation enemyAnimation2 = new Animation();

            // Initialize the animation with the correct animation information
            enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true);
            enemyAnimation2.Initialize(enemyTexture2, Vector2.Zero, 80, 75, 2, 40, Color.White, 1f, true);

            // Randomly generate the position of the enemy
            Vector2 position  = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));
            Vector2 position2 = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture2.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));

            // Create an enemy
            Enemy  enemy  = new Enemy();
            Enemy2 enemy2 = new Enemy2();

            // Initialize the enemy
            enemy.Initialize(enemyAnimation, position);
            enemy2.Initialize(enemyAnimation2, position2);

            // Add the enemy to the active enemies list
            enemies.Add(enemy);
            enemies2.Add(enemy2);
        }
示例#2
0
        private void AddEnemy()
        {
            Animation enemyAnimation = new Animation();

            enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true);
            Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));
            Enemy   enemy    = new Enemy();

            enemy.Initialize(enemyAnimation, position);
            enemies.Add(enemy);
        }
示例#3
0
        private void AddEnemy()
        {
            Animation enemyAnimation = new Animation();

            enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 375, 454, 8, 35, Color.White, 0.17f, true, 0, Vector2.Zero,
                                      SpriteEffects.None, 0);
            Sound enemyExplosionSound;

            enemyExplosionSound = new Sound(Content, "Sounds\\explosion", 0.17f, false);

            Enemy enemy = new Enemy();

            enemy.Initialize(enemyAnimation, GetRandomPosition(50, -enemyTexture.Height / 2), 20, enemyExplosionSound);
            enemies.Add(enemy);
        }
示例#4
0
        //Addmin enemies to the field!
        private void AddEnemy()
        {
            //create an animation
            Animation enemyAnimation = new Animation();

            //initialize position with the correct sizes
            enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true);

            //initialize the position of the enemy
            Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));

            //create an enmey
            Enemy enemy = new Enemy();

            //initialize the enmy
            enemy.Initialize(enemyAnimation, position);

            //add enemy to the game
            enemies.Add(enemy);
        }
示例#5
0
        private void UpdateEnemies(GameTime gameTime)
        {
            if (gameTime.TotalGameTime - Enemy.PrevSpawnTime > Enemy.SpawnTime)
            {
                Enemy.PrevSpawnTime = gameTime.TotalGameTime;

                if (!isGameEnded)
                {
                    enemyCount++;

                    if (enemyCount == 7)
                    {
                        shootingEnemy.Initialize(shootingEnemyAnimation, GetRandomPosition(50, -25), 40, shootingEnemyExplosionSound);
                        enemyCount = 0;
                    }
                    else
                    {
                        AddEnemy();
                    }
                }
            }

            // Update the Enemies
            for (int i = enemies.Count - 1; i >= 0; i--)
            {
                enemies[i].Update(gameTime, graphics, enemyMoveSpeed);
                if (enemies[i].Active == false)
                {
                    enemies.RemoveAt(i);
                }
            }

            if (shootingEnemy.Active)
            {
                shootingEnemy.Update(gameTime, graphics, shootingEnemyMoveSpeed);
                FireEnemyLaser(gameTime);
            }
        }
示例#6
0
        private void AddEnemy()
        {
            Animation enemyAnimation = new Animation();
            enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true);
            Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));

            Enemy enemy = new Enemy();
            enemy.Initialize(enemyAnimation, position);
            enemies.Add(enemy);
        }
        private void AddEnemy()
        {
            // Create the animation object
            Animation enemyAnimation = new Animation();

            // Initialize the animation with the correct animation information
            enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true);

            // Randomly generate the position of the enemy
            Vector2 position = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, ScreenManager.GraphicsDevice.Viewport.Height - 100));

            // Create an enemy
            Enemy enemy = new Enemy();

            // Initialize the enemy
            enemy.Initialize(enemyAnimation, position);

            // Add the enemy to the active enemies list
            enemies.Add(enemy);
        }
示例#8
0
        private void AddEnemy()
        {
            // Randomly generate the position of the enemy
            Vector2 position = new Vector2(random.Next(0, GraphicsDevice.Viewport.Width), -10);

            // Create an enemy
            Enemy enemy = new Enemy();

            // Initialize the enemy
            enemy.Initialize(enemyTexture, position);

            // Add the enemy to the active enemies list
            enemies.Add(enemy);
        }
示例#9
0
        private void AddEnemy()
        {
            // Create the animation object
            Animation enemyAnimation = new Animation();

            // Initialize the animation with the correct animation information
            enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30,Color.White, 1f, true);

            // Randomly generate the position of the enemy
            Vector2 position = new Vector2(GraphicsDevice.Viewport.Width +enemyTexture.Width / 2, random.Next(50, GraphicsDevice.Viewport.Height -50)); // 50, and -50 represent the area in which they spawn (higher the number the smaller the area, closer to center)

            // Create an enemy
            Enemy enemy = new Enemy();

            // Initialize the enemy
            enemy.Initialize(enemyAnimation, position);

            // Condition to see if the level changed then make my enemies harder
            /*
            if (level != prevLevel)
            {
                levelUp = true;
            }
            */
            /*
            if (levelUp == true)
            {
                enemy.Damage = enemy.Damage + 20;
                enemy.Health = enemy.Health + 20;
                enemy.enemyMoveSpeed = enemy.enemyMoveSpeed + 2;
                enemy.Value = enemy.Value + 20;
                //UpdatePlayer(blah); // figure out parameter shit because I need to change player class attributes before leaving if statement :)
                AddProjectile(position);

                levelUp = false;
            }
            */
            // Add the enemy to the active enemies list
            enemies.Add(enemy);
        }
示例#10
0
 // ��������� ������
 private void AddEnemy()
 {
     // ��������� ��'���� �������
     Animation enemyAnimation = new Animation();
     // ����������� ������� ������
     enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true);
     // ��������� ��������� ������� ������
     Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));
     // ��������� ��'���� �����
     Enemy enemy = new Enemy();
     // ����������� ������
     enemy.Initialize(enemyAnimation, position, enemyHealth, enemyMoveSpeed);
     // ��������� ������ �� ������ ��������, � ����� ������, ������
     enemies.Add(enemy);
 }