Ejemplo n.º 1
0
 public Player(SpriteBatch sb, string playerName, int maxHealth, Texture2D playerTex, Vector2 playerPos, GamePadInput input)
 {
     padInput = input;
     this.sb = sb;
     this.playerName = "";
     this.playerName = playerName;
     this.maxHealth = maxHealth;
     playerTexture = playerTex;
     this.playerPos = playerPos;
        // playerMoveSpeed = 3.0f;
     isDead = false;
     currentHealth = maxHealth;
     direction.X = 0;
     direction.Y = -1;
     centre = new Vector2(playerTexture.Width / 2, playerTexture.Height / 2);
 }
Ejemplo n.º 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);

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

            blackHealth = Content.Load<Texture2D>("TEX_HealthBarBorder");
            redHealth = Content.Load<Texture2D>("TEX_HealthBarRedFill");
            greenHealth = Content.Load<Texture2D>("TEX_HealthBarGreenFill");
            playerTex = Content.Load<Texture2D>("TEX_PlayerSprite");
            enemyTex = Content.Load<Texture2D>("player");
            playerTwoTex = Content.Load<Texture2D>("TEX_PlayerSprite");
            wallTextures.Add(Content.Load<Texture2D>("wall1"));
            wallTextures.Add(Content.Load<Texture2D>("wall2"));
            wallTextures.Add(Content.Load<Texture2D>("wall3"));
            floorTex = Content.Load<Texture2D>("floor");

            UI = new ShootyPowPow.UI.UI(spriteBatch, font, greenHealth, blackHealth, redHealth);
            input = new Input();
            padInput = new GamePadInput(PlayerIndex.One);
            padInput2 = new GamePadInput(PlayerIndex.Two);
            //player = new Player(spriteBatch, "Josh", 100, playerTex, Vector2.Zero, input);
            player = new Player(spriteBatch, "FirstPlayer", 100, playerTex, Vector2.Zero, padInput);
            enemy = new Player(spriteBatch, "Jiggly", 100, enemyTex, new Vector2(300, 300));

            playerTwo = new Player(spriteBatch, "SecondPlayer", 100, playerTwoTex, new Vector2(500, 50), padInput2);

            for (int i = 1; i < 9; i++)
            {
                bulletTextures.Add(Content.Load<Texture2D>(string.Concat("TEX_Bullet", i)));
            }
            // TODO: use this.Content to load your game content here
        }