Time for action – the enemy manager
Add a new class called EnemyManager to the Robot Rampage project.
Add the following
using
directives to the top of the class file:using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics;
Modify the declaration of the class to make it a static class:
static class EnemyManager
Add declarations to the EnemyManager class:
#region Declarations public static List<Enemy> Enemies = new List<Enemy>(); public static Texture2D enemyTexture; public static Rectangle enemyInitialFrame; public static int MaxActiveEnemies = 30; #endregion
Add the
Initialize()
method to the EnemyManager class:#region Initialization public static void Initialize( Texture2D texture, Rectangle initialFrame) { enemyTexture = texture; enemyInitialFrame = initialFrame; } #endregion
Add the
AddEnemy()
method to the EnemyManager class:#region Enemy Management public static void AddEnemy(Vector2 squareLocation) { int startX = (int)squareLocation.X; int...