static void Initialize(Engine engine)
        {
            Console.OutputEncoding = System.Text.Encoding.Unicode;
            Console.SetWindowSize(GameCols + 2, GameRows + 2);

            // Generate couple briks
            for (int i = 0; i < 10; i++)
            {
                var brick = new Brick(new MatrixCoords(GameRows - 4, rand.Next(10, GameCols - 20)));
                engine.AddObject(brick);
            }

            // Generate ten enemies
            for (int i = 0; i < 10; i++)
            {
                 var enemy = new Bomb(new MatrixCoords(rand.Next(5, GameRows - 15), rand.Next(GameRows - 15, GameCols - 2)), new MatrixCoords(1, 0));
                 engine.AddObject(enemy);
             }
            for (int i = 0; i < 10; i++)
            {
                var enemy = new Turtle(new MatrixCoords(rand.Next(5, GameRows - 15), rand.Next(GameRows - 15, GameCols - 2)), new MatrixCoords(0, -1));
                engine.AddObject(enemy);
            }

            var theBoss = new SuperEvil(new MatrixCoords(rand.Next(5, GameRows), rand.Next(GameRows, GameCols)), new MatrixCoords(2, -2));
            engine.AddObject(theBoss);

            var timer = new Timer(new MatrixCoords(1, 1));
            engine.AddObject(timer);

            var displayLives = new DisplayLives(new MatrixCoords(1, 20));
            engine.AddObject(displayLives);

            var mario = new Mario(new MatrixCoords(GameRows - 20, 2));
            engine.AddObject(mario);

            // Add some bonus and lives

            for (int i = 0; i < 3; i++)
            {
                var bonusPoints = new BonusPoints(new MatrixCoords(rand.Next(15, GameRows - 15), rand.Next(GameRows, GameCols)), new MatrixCoords(0, -1));
                engine.AddObject(bonusPoints);

                var bonusLives = new BonusLives(new MatrixCoords(rand.Next(10, GameRows - 5), rand.Next(GameRows, GameCols)), new MatrixCoords(0, -1));
                engine.AddObject(bonusLives);
            }
        }
Example #2
0
        static void Initialize(Engine engine)
        {
            Console.OutputEncoding = System.Text.Encoding.Unicode;
            Console.SetWindowSize(GameCols + 2, GameRows + 2);
            //Console.SetBufferSize(9999, 300);

            // Generate couple briks
            for (int i = 0; i < 10; i++)
            {
                var brick  = new Brick(new MatrixCoords(GameRows - 4, rand.Next(10, GameCols - 20)));
                var brick4 = new Brick(new MatrixCoords(GameRows - 4, rand.Next(10, GameCols - 20)));
                engine.AddObject(brick);
                engine.AddObject(brick4);
            }

            var brick2 = new Brick(new MatrixCoords(GameRows - 20, rand.Next(10, 10)));

            engine.AddObject(brick2);

            var brick5 = new Brick(new MatrixCoords(GameRows - 25, rand.Next(10, 10)));

            engine.AddObject(brick5);

            var brick3 = new Brick(new MatrixCoords(GameRows - 15, rand.Next(10, 10)));

            engine.AddObject(brick3);

            // Generate ten enemies
            for (int i = 0; i < 10; i++)
            {
                var enemy = new Enemy(new MatrixCoords(rand.Next(5, GameRows - 15), rand.Next(GameRows - 15, GameCols - 2)), new MatrixCoords(0, -1));
                engine.AddObject(enemy);
            }

            var mario = new Mario(new MatrixCoords(GameRows - 11, 2));

            engine.AddObject(mario);
        }
Example #3
0
        private void AddMario(GameObject obj)
        {
            this.playerMario = obj as Mario;

            for (int i = 0; i < this.allObjects.Count; i++)
            {
                if (this.allObjects[i] is Mario)
                {
                    this.allObjects.RemoveAt(i);
                    i--;
                }
            }

            for (int i = 0; i < this.staticObjects.Count; i++)
            {
                if (this.staticObjects[i] is Mario)
                {
                    this.staticObjects.RemoveAt(i);
                    i--;
                }
            }

            this.AddStaticObject(obj);
        }
Example #4
0
        private void AddMario(GameObject obj)
        {
            this.playerMario = obj as Mario;

            for (int i = 0; i < this.allObjects.Count; i++)
            {
                if (this.allObjects[i] is Mario)
                {
                    this.allObjects.RemoveAt(i);
                    i--;
                }
            }

            for (int i = 0; i < this.staticObjects.Count; i++)
            {
                if (this.staticObjects[i] is Mario)
                {
                    this.staticObjects.RemoveAt(i);
                    i--;
                }
            }

            this.AddStaticObject(obj);
        }