Esempio n. 1
0
 /// <summary>
 /// Allows the game component to perform any initialization it needs to before starting
 /// to run.  This is where it can query for any required services and load content.
 /// </summary>
 public override void Initialize()
 {
     spriteBatch = new SpriteBatch(Game.GraphicsDevice);
     for (int i = 0; i < rows.Length; i++)
     {
         TileColor rowColor;
         Vector2   rowLocation = new Vector2();
         rowLocation.Y = location.Y + i * DistanceBetweenRows + i * Tile.TileDimension;
         rowLocation.X = (i % 2 == 0 ? location.X : OddRowOffset);
         if (i < 2)
         {
             rowColor = TileColor.Red;
         }
         else if (i < 4)
         {
             rowColor = TileColor.Orange;
         }
         else if (i < 6)
         {
             rowColor = TileColor.Yellow;
         }
         else
         {
             rowColor = TileColor.Green;
         }
         rows[i]             = new TileRow(Game, rowColor);
         rows[i].Location    = rowLocation;
         rows[i].MovingRight = (i % 2 == 0 ? true : false);
         moveSound           = Game.Content.Load <SoundEffect>(@"Effects\movement");
     }
     base.Initialize();
 }
Esempio n. 2
0
 public Tile(Game game, TileRow row, TileColor color)
     : base(game)
 {
     UpdateOrder = BrickInvaders.TilePriority;
     Game.Components.Add(this);
     Cleared            = false;
     this.containingRow = row;
     this.color         = color;
 }
Esempio n. 3
0
 public Tile(Game game, TileRow row, TileColor color)
     : base(game)
 {
     UpdateOrder = BrickInvaders.TilePriority;
     Game.Components.Add(this);
     Cleared = false;
     this.containingRow = row;
     this.color = color;
 }
Esempio n. 4
0
 /// <summary>
 /// Allows the game component to perform any initialization it needs to before starting
 /// to run.  This is where it can query for any required services and load content.
 /// </summary>
 public override void Initialize()
 {
     spriteBatch = new SpriteBatch(Game.GraphicsDevice);
     for (int i = 0; i < rows.Length; i++) {
         TileColor rowColor;
         Vector2 rowLocation = new Vector2();
         rowLocation.Y = location.Y + i * DistanceBetweenRows + i * Tile.TileDimension;
         rowLocation.X = (i % 2 == 0 ? location.X : OddRowOffset);
         if (i < 2) {
             rowColor = TileColor.Red;
         } else if (i < 4) {
             rowColor = TileColor.Orange;
         } else if (i < 6) {
             rowColor = TileColor.Yellow;
         } else {
             rowColor = TileColor.Green;
         }
         rows[i] = new TileRow(Game, rowColor);
         rows[i].Location = rowLocation;
         rows[i].MovingRight = (i % 2 == 0 ? true : false);
         moveSound = Game.Content.Load<SoundEffect>(@"Effects\movement");
     }
     base.Initialize();
 }