示例#1
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            if (_selectedLevel == null)
                _startMenu.Show(_graphics);
            else
            {
                _startMenu.Hide(_graphics);
                _selectedLevel = _xmlManager.Load(_xmlPath);

                LoadFeatures();
                _selectedLevel.Load();

                _controller = new GameController(_selectedLevel);
            }
        }
示例#2
0
        public void loadContent()
        {
            TextureLoader textureLoader = TextureLoader.GetInstance();

            Texture2D blockSpriteA = Content.Load<Texture2D>("blockA");
            Texture2D blockSpriteB = Content.Load<Texture2D>("blockB");
            Texture2D coin = Content.Load<Texture2D>("coin");
            Texture2D background = Content.Load<Texture2D>("b");
            Texture2D weapon_texture = Content.Load<Texture2D>("weapon");
            Texture2D ammo_texture = Content.Load<Texture2D>("ammo");

            textureLoader.addTexture("blockA", blockSpriteA);
            textureLoader.addTexture("blockB", blockSpriteB);
            textureLoader.addTexture("coin", coin);
            textureLoader.addTexture("b", background);
            textureLoader.addTexture("weapon", weapon_texture);
            textureLoader.addTexture("ammo", ammo_texture);

            font = Content.Load<SpriteFont>("Font");
            deadFont = Content.Load<SpriteFont>("DeadFont");

            Texture2D ballSprite = Content.Load<Texture2D>("ball");
            player = new Player(Vector2.Zero, 6.0f, new Rectangle(0, 0, 3900,
                1200));

            selected_level.SetPlayer(player);
            selected_level.Layers[0].addSprite(new Background(Vector2.Zero));

            ShootableWeapon w1;
            w1 = new ShootableWeapon("ak47", weapon_texture, player._Position, 0);
            player.addWeapon(w1);
            player.SetCurrentWeapon(0);

            selected_level.addEnemy(50, 5);

            selected_level.Load();
            Controller = new GameController(selected_level);
        }