Beispiel #1
0
        public Brick(BrokededAut game, Level level, byte index, int x, int y)
            : base(game)
        {
            _game = game;
            _level = level;

            Color[] colors = new Color[]
            {
                Color.DarkMagenta,
                Color.Yellow,
                Color.Blue,
                Color.Red,
                Color.Green,
                Color.Gray
            };

            _color = colors[index];
            _position = new Vector2(x, y);

            _spiteBatch = new SpriteBatch(_game.GraphicsDevice);

            Score = 100 * (index + 1); // TODO set this depending on which brick exactly that we represent

            Width = Config.Brick.Width;
            Height = Config.Brick.Height;
        }
Beispiel #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()
        {
            _entities = new List<IEntity>();
            _level = new Level(this);

            base.Initialize();
        }
Beispiel #3
0
        protected override void Initialize()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            Window.Title = Config.Game.Title;

            Width = _deviceManager.PreferredBackBufferWidth = Config.Game.Width;
            Height = _deviceManager.PreferredBackBufferHeight = Config.Game.Height;
            _deviceManager.ApplyChanges();

            _totalScore = _levelScore = 0;
            _currentLevel = 1;
            _lives = Config.Game.InitialLives;

            _livesFormat = Config.UI.LivesFormat;
            _scoreFormat = Config.UI.ScoreFormat;
            _levelFormat = Config.UI.LevelFormat;

            Balls = new Collection<Ball>();

            var aBall = new Ball(this);
            Components.Add(aBall);
            Balls.Add(aBall);
            aBall = null;

            Level = new Level(this);
            Components.Add(Level);
            Level.OnBrickDie = IncreaseScore;

            Pad = new Pad(this);
            Components.Add(Pad);

            _previousKeyboardState = Keyboard.GetState();

            base.Initialize();
        }