Ejemplo n.º 1
0
        public Fighter(TextureHandler texture, Rectangle screen, int index, Rectangle view)
        {
            screenRectangle = screen;
            fighterTexture = texture;
            playerIndex = index;
            viewPort = view;

            switch (playerIndex)
            {
                    //Spawn fighter on left if player 1
                case 1:
                    position = new Vector2((viewPort.Left + 60), (screenRectangle.Height - 20));
                    break;
                    //Spawn fighter on right if player 2
                case 2:
                    position = new Vector2((viewPort.Right - fighterTexture.Width - 60), (screenRectangle.Height - 20));
                    break;
            }

            groundPosition = (screenRectangle.Height - 20);
            rightWall = (screenRectangle.Width - fighterTexture.Width);
            truePos = new Vector2(position.X, (position.Y - fighterTexture.Height));
            inputParser = new InputParser(this);
        }
Ejemplo n.º 2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            p1Char = new Character(p1Selection);
            p2Char = new Character(p2Selection);

            p1CharName = p1Char.name;
            p2CharName = p2Char.name;

            f1AniTexture = new TextureHandler(p1CharName);
            f2AniTexture = new TextureHandler(p2CharName);

            f1AniTexture.Load(GraphicsDevice, Content);
            f2AniTexture.Load(GraphicsDevice, Content);

            fighter1 = new Fighter(f1AniTexture, screenRectangle, 1, viewBox);
            fighter2 = new Fighter(f2AniTexture, screenRectangle, 2, viewBox);

            background = Content.Load<Texture2D>("Background1");
        }