// Constructor public EnemyFactory(Dictionary <int, Texture2D> graphics, Texture2D shotGraphic, Rectangle initialFrame, int frameCount, Rectangle screenBounds, LevelManager level, PlayerFactory playerFactory) { this.graphics = graphics; this.frameCount = frameCount; this.playerFactory = playerFactory; this.curLevel = level; EnemyShots = new ProjectileFactory(shotGraphic, new Rectangle(0, 0, 16, 16), 3, 2, 200f, screenBounds); }
// Constructor...graphic name, Rectangle for the initial animation frame, #frames in strip, Rectangle for view size public PlayerFactory(Texture2D graphic, Texture2D shotGraphic, Rectangle initialFrame, int frameCount, Rectangle screenBounds) { player = new Player(new Vector2(512, 650), graphic, initialFrame, Vector2.Zero); playerShots = new ProjectileFactory(shotGraphic, new Rectangle(0, 0, 16, 16), 3, 2, 250f, screenBounds); //player is limited to the bottom half of the screen playerBounds = new Rectangle(0, screenBounds.Height / 2, screenBounds.Width, screenBounds.Height / 2); for (int i = 1; i < frameCount; i++) { player.AddFrame( new Rectangle( // iterate through frames...animation frames should be of equal width initialFrame.X + (initialFrame.Width * i), initialFrame.Y, initialFrame.Width, initialFrame.Height)); } player.CollisionRadius = player.playerRadius; }