Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the Game class.
 /// </summary>
 /// <param name="boundaries">The rectangle representing the gaming area.</param>
 /// <param name="random">A Random for use with all inner functions requiring a random.</param>
 public Game(Rectangle boundaries, Random random) {
     /* initialize the two accepted parameters before 
      ANYTHING else.*/
     this.boundaries = boundaries;
     this.random = random;
     this.playerShipStartingLocation = new Point(boundaries.Right - 100, boundaries.Bottom - 50);
     this.mothershipStartingLocation = new Point(boundaries.Left + 40, 90);
     this.motherShipDirection = Direction.Right;
     this.motherShip = null;
     this.motherShipTravelArea = new Rectangle(new Point(boundaries.Left, 90), new Size(boundaries.Width, 40));
     this.playerShip = new PlayerShip(playerShipStartingLocation);
     this.playerShots = new List<Shot>();
     this.playerBombs = new List<Bomb>();
     this.invaderShots = new List<Shot>();
     this.invaders = new List<Invader>();
     this.livesLeftDisplay = new List<Bitmap>();
     this.deadInvaderExplosions = new List<Explosion>();
     this.otherExplosions = new List<Explosion>();
     this.deadInvaderScores = new List<ScoreFlash>();
     this.mothershipHasAppeared = false;
     this.stars = new Stars(boundaries, random);
     for (int i = 0; i < livesLeft; i++)
         livesLeftDisplay.Add(playerShip.GetImage());
     NextWave();
 } // end constructor method Game