public void Initialize(EnemyAnimation animation, Vector2 position) { // Set the position of the enemy EnemyAnimation = 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 = 75; // Set the amount of damage the enemy can do Damage = 10; // Set how fast the enemy moves enemyMoveSpeed = 4f; // Set the score value of the enemy Value = 100; }
private void AddEnemy() { // Create the animation object EnemyAnimation enemyAnimation = new EnemyAnimation(); // Initialize the animation with the correct animation information enemyAnimation.Initialize(enemyTexture, 0, 50, 50); // Randomly generate the position of the enemy Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height)); // 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); }