コード例 #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //carregando as texturas
            ResourceManager.Instance.LoadTextures(Content, GraphicsDevice);

            //-----------------------------------------
            //Ryu
            //carregando a extrutura xml do personagem para um objeto com a mesma estrutura
            PlayerXml xml = Content.Load<PlayerXml>(ResourceManager.pastaPersonagens + "/" + ResourceManager.personagemSFARyu);
            //criando player
            player1 = new Player(xml);
            player1.PosX = (Window.ClientBounds.Width - 150) / 2;
            player1.PosY = (Window.ClientBounds.Height - 100) / 2;

            //config. teclas de acao
            ControllerConfiguration controller1 = new ControllerConfiguration();
            controller1.HardPunch = Keys.Q;
            controller1.Left = Keys.J;
            controller1.Right = Keys.L;
            player1.Controller = controller1;
            //-----------------------------------------
            //SFIIIAkuma
            PlayerXml xmlSFIIIAkuma = Content.Load<PlayerXml>(ResourceManager.pastaPersonagens + "/" + ResourceManager.personagemSFIIIAkuma);
            player2 = new Player(xmlSFIIIAkuma);
            player2.PosX = (Window.ClientBounds.Width + 150) / 2;
            player2.PosY = (Window.ClientBounds.Height - 135) / 2;
            player2.FaceLeft = true;

            ControllerConfiguration controller2 = new ControllerConfiguration();
            controller2.HardPunch = Keys.D9;
            controller2.Left = Keys.Left;
            controller2.Right = Keys.Right;
            player2.Controller = controller2;
            //-----------------------------------------
            //AkumaHD
            PlayerXml xmlAkumaHD = Content.Load<PlayerXml>(ResourceManager.pastaPersonagens + "/" + ResourceManager.personagemHDAkuma);
            //PlayerXml xmlAkumaMove = Content.Load<PlayerXml>(@"Personagens/AkumaHD");
            playerAkuma = new Player(xmlAkumaHD);
            playerAkuma.PosX = (Window.ClientBounds.Width + 800) / 2;
            playerAkuma.PosY = (Window.ClientBounds.Height - 500) / 2;
            playerAkuma.FaceLeft = false;
            playerAkuma.Controller = null;
            //-----------------------------------------
        }
コード例 #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //carregando as texturas
            ResourceManager.Instance.LoadTextures(Content, GraphicsDevice);

            //carregando a extrutura xml do personagem para um objeto com a mesma estrutura
            PlayerXml xml = Content.Load<PlayerXml>(@"Personagens/Ryu");

            //criando player
            player1 = new Player(xml);
            player1.PosX = 50;
            player1.PosY = 100;

            //config. teclas de acao
            ControllerConfiguration controller1 = new ControllerConfiguration();
            controller1.HardPunch = Keys.Q;
            controller1.Left = Keys.J;
            controller1.Right = Keys.L;
            player1.Controller = controller1;

            player2 = new Player(xml);
            player2.PosX = 250;
            player2.PosY = 100;
            player2.FaceLeft = false;

            ControllerConfiguration controller2 = new ControllerConfiguration();
            controller2.HardPunch = Keys.D9;
            controller2.Left = Keys.Left;
            controller2.Right = Keys.Right;
            player2.Controller = controller2;
        }