// remove the specified brick from this level's collection public void DeleteBrick(Brick brick) { if (Bricks.Contains(brick)) { Bricks.Remove(brick); Changed = true; } }
// add a new brick to the level, given the coordinate // of the a top, left corner, knowing the width and // height of all bricks on this level public Brick AddBrick(int x, int y, int hits) { Brick brick = null; if (x >= 0 && y >= 0) { brick = new Brick(); brick.X = x; brick.Y = y; brick.HitsToClear = hits; Bricks.Add(brick); Changed = true; } return brick; }