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.playerShip       = new PlayerShip(playerShipStartingLocation);
     this.playerShots      = new List <Shot>();
     this.invaderShots     = new List <Shot>();
     this.invaders         = new List <Invader>();
     this.livesLeftDisplay = new List <Bitmap>();
     this.stars            = new Stars(boundaries, random);
     for (int i = 0; i < livesLeft; i++)
     {
         livesLeftDisplay.Add(playerShip.GetLivesLeftImage());
     }
     NextWave();
 } // end constructor method Game