// constructor public BombFactory(Game1 game, int screenHeight, PlayerSprite player) : base(game, screenHeight) { bullets = new List <ProjectileSprite>(); this.game = game; this.screenHeight = screenHeight; this.player = player; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { setWindowPosition(); //Creates the main menu mainMenu = new MainMenu(this); //Creates the game over menu gameOverMenu = new GameOverMenu(this); hsDisplay = new HighScoreDisplay(this, screenHeight, screenWidth); //Generates the starfield starfield = new Starfield(this, screenHeight); laser = new LaserFactory(this, graphics.PreferredBackBufferHeight); playerSprite = new PlayerSprite(this, laser); bomb = new BombFactory(this, graphics.PreferredBackBufferHeight, playerSprite); mothershipSprite = new MothershipSprite(this, laser); alienSquad = new AlienSquad(this, screenWidth, screenHeight, bomb, laser, mothershipSprite, playerSprite); score = new ScoreSprite(this, bomb, laser, alienSquad); laser.SetAlienSquad(alienSquad); laser.SetMothership(mothershipSprite); Components.Add(new GamerServicesComponent(this)); Components.Add(starfield); Components.Add(mainMenu); Components.Add(gameOverMenu); Components.Add(hsDisplay); Components.Add(laser); Components.Add(bomb); Components.Add(playerSprite); Components.Add(mothershipSprite); Components.Add(alienSquad); Components.Add(score); base.Initialize(); }
// Constructor public AlienSquad(Game1 game, int screenWidth, int screenHeight, BombFactory bomb, LaserFactory laser, MothershipSprite mothershipSprite, PlayerSprite playerSprite) : base(game) { this.game = game; this.screenWidth = screenWidth; this.screenHeight = screenHeight; this.bomb = bomb; this.mothershipSprite = mothershipSprite; this.playerSprite = playerSprite; dir = Direction.RIGHT; alienSquad = new AlienSprite[3, 8]; currentListPos = 0; motionCtr = 0; setAlienMotionPictures(); laser.AlienCollision += killAlien; killedCount = 0; level = 1; alienLevel = 1; aLaser = laser; }