Example #1
0
        public void Initialize(ToasterAnimation animation, Vector2 position, string direction)
        {
            // Set the position of the enemy
            ToasterAnimation = animation;
            Position = position;

            // We initialize the enemy to be active so it will be update in the game
            Active = true;

            // Set the health of the enemy
            Health = 50;

            // Set the amount of damage the enemy can do
            //Very Weak
            Damage = 5;

            // Set how fast the enemy moves
            enemyMoveSpeed = 5f;

            Direction = direction;
            // Set the score value of the enemy
            //More value due to more danger
            Value = 125;
        }
Example #2
0
        private void AddToastEnemy()
        {
            //Create animation Object
            string direction = "";
            Random Rando = new Random();
            int dir = Rando.Next(0, 4);
            switch (dir)
            {
                case 0:
                    direction = "Top";
                    break;
                case 1:
                    direction = "Left";
                    break;
                case 2:
                    direction = "Bottom";
                    break;
                case 3:
                    direction = "Right";
                    break;

            }
            ToasterAnimation toastAnimation = new ToasterAnimation();

            toastAnimation.Initialize(toastEnemyTexture, 0, 50, 100);

            Vector2 toastPosition = new Vector2(GraphicsDevice.Viewport.Width - toastEnemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height)); // bad work

            ToasterEnemy toastEnemy = new ToasterEnemy();
            toastEnemy.Initialize(toastAnimation, toastPosition, direction);
            toastEnemies.Add(toastEnemy);
        }