예제 #1
0
 public Brick(int width, int height, Point position, Game.BrickColor brickColor, int lives)
 {
     Width      = width;
     Height     = height;
     Position   = position;
     Lives      = lives;
     BrickColor = brickColor;
     SetColorBasedOnLives();
     HitBox = new Rectangle(Position.X, Position.Y, Width, Height);
 }
예제 #2
0
        private Level GenerateRandomLevel(int levelMultiplier, int id, Game.BrickColor brickColor)
        {
            List <Brick> BrickList   = new List <Brick>();
            int          RandomH     = levelMultiplier;
            int          RandomW     = levelMultiplier;
            int          BrickWidth  = (FULLSCREEN_SIZE.Width / RandomW);
            int          BrickHeight = FULLSCREEN_SIZE.Height / 4 / RandomH;

            for (int i = 0; i < RandomH; i++)
            {
                for (int j = 0; j < RandomW; j++)
                {
                    Point brickPoint = new Point(BrickWidth * j + FULLSCREEN_SIZE.Width % RandomW / 2, BrickHeight * i + SPACE_FROM_TOP);
                    Brick brick      = new Brick(BrickWidth, BrickHeight, brickPoint, brickColor, random.Next(1, 4));
                    BrickList.Add(brick);
                }
            }
            return(new Level(BrickList, FULLSCREEN_SIZE, id));
        }