Exemple #1
0
        public GamePresenter(IWantToBeNotifiedOfGameTimeElapsedEvents view)
        {
            _view = view;
            _gameLoop.Register(_world);
            _gameLoop.Register(_view);
            _goodGuy = new GoodGuy(_world);

            CreateDummyLevel(_world, _goodGuy);

            _gameLoop.Register(_goodGuy);
            _gameLoop.Start();
        }
Exemple #2
0
        private void CreateDummyLevel(IWorldMatrix world, GoodGuy goodGuy)
        {
            //++ dummy implementation of a world - say a level
            //todo: make abstraction of a level
            for (var i = 0; i < 200; i += 10)
            {
                world.Add(i, 0, new Stone());
                world.Add(i, 190, new Stone());
            }

            for (var i = 10; i < 190; i += 10)
            {
                world.Add(0, i, new Stone());
                world.Add(190, i, new Stone());
            }

            IRnd randomizer = new Rnd(200, 200);
            world.Add(50, 25, new Monster(world, randomizer));
            world.Add(150, 25, new Monster(world, randomizer));
            world.Add(50, 125, new Monster(world, randomizer));
            world.Add(150, 125, new Monster(world, randomizer));

            world.Add(100, 100, goodGuy);
            //-- dummy level
        }