Exemplo n.º 1
0
        private void InitializeLevel()
        {
            _rectangles = new List<PaintedRectangle>();
            _player = new Player();
            _lines = new Lines();
            _player.Initialize(Globals.XMin, Globals.YMin);
            _lines.Initialize();
            _paints = new List<Paint>();

            _score = 0;

            for (var n = 0; n < _level; n++)
            {
                var newPaint = new Paint();
                newPaint.Initialize((Globals.XMax + Globals.XMin) / 2 + Globals.Rng.Next(-125, 125), (Globals.YMax + Globals.YMin) / 2 + Globals.Rng.Next(-125, 125));
                _paints.Add(newPaint);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            Globals.XMin = 20;
            Globals.XMax = GraphicsDevice.Viewport.Width - 20;
            Globals.YMin = 20;
            Globals.YMax = GraphicsDevice.Viewport.Height - 100;
            _rectangles = new List<PaintedRectangle>();
            _player = new Player();
            _lines = new Lines();
            _player.Initialize(Globals.XMin, Globals.YMin);
            _lines.Initialize();
            _paints = new List<Paint>();
            _level = 0;
            _score = 0;
            _levelStart = true;
            _levelEnd = false;
            _titleScreen = true;

            for (var n = 0; n < 6; n++)
            {
                var newPaint = new Paint();
                newPaint.Initialize((Globals.XMax + Globals.XMin) / 2 + Globals.Rng.Next(-25, 25), (Globals.YMax + Globals.YMin) / 2 + Globals.Rng.Next(-25, 25));
                _paints.Add(newPaint);
            }

                base.Initialize();
        }