Ejemplo n.º 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);

            // Player
            PlayerSpriteInfo.Texture = Content.Load <Texture2D>(PlayerSpriteInfo.SPRITESHEET_PATH);
            var playerInput  = new Input(Keys.Up, Keys.Down, Keys.Left, Keys.Right);
            var playerSprite = new Sprite(PlayerSpriteInfo.GenerateAnimations(), PLAYER_STARTING_POSITION, playerInput, true);

            sprites.Add(playerSprite);

            //Goblin
            GoblinSpriteInfo.Texture = Content.Load <Texture2D>(GoblinSpriteInfo.SPRITESHEET_PATH);
            var goblinSprite = new Sprite(GoblinSpriteInfo.GenerateAnimations(), GOBLIN_STARTING_POSITION, null, false);

            sprites.Add(goblinSprite);
        }
Ejemplo n.º 2
0
    void LoadPlayerSprite()
    {
        playerSprites       = new Dictionary <PlayerSpriteInfo, Sprite>();
        playerAttackSprites = new Dictionary <PlayerSpriteInfo, Sprite>();
        playerDefendSprites = new Dictionary <PlayerSpriteInfo, Sprite>();
        spriteInfo          = new List <PlayerSpriteInfo>();
        int i = 0;

        foreach (Sprite s in fighterSprites)
        {
            PlayerSpriteInfo psi = new PlayerSpriteInfo(PlayerClass.Fighter, i);
            playerSprites[psi] = s;
            spriteInfo.Add(psi);
            i++;
        }

        i = 0;
        foreach (Sprite s in mageSprites)
        {
            PlayerSpriteInfo psi = new PlayerSpriteInfo(PlayerClass.Mage, i);
            playerSprites[psi] = s;
            spriteInfo.Add(psi);
            i++;
        }

        i = 0;
        foreach (Sprite s in rogueSprites)
        {
            PlayerSpriteInfo psi = new PlayerSpriteInfo(PlayerClass.Rogue, i);
            playerSprites[psi] = s;
            spriteInfo.Add(psi);
            i++;
        }

        i = 0;
        foreach (Sprite s in archerSprites)
        {
            PlayerSpriteInfo psi = new PlayerSpriteInfo(PlayerClass.Archer, i);
            playerSprites[psi] = s;
            spriteInfo.Add(psi);
            i++;
        }

        i = 0;
        foreach (Sprite s in fighterAttackSprites)
        {
            PlayerSpriteInfo psi = new PlayerSpriteInfo(PlayerClass.Fighter, i);
            playerAttackSprites[psi] = s;
            i++;
        }

        i = 0;
        foreach (Sprite s in mageAttackSprites)
        {
            PlayerSpriteInfo psi = new PlayerSpriteInfo(PlayerClass.Mage, i);
            playerAttackSprites[psi] = s;
            i++;
        }

        i = 0;
        foreach (Sprite s in rogueAttackSprites)
        {
            PlayerSpriteInfo psi = new PlayerSpriteInfo(PlayerClass.Rogue, i);
            playerAttackSprites[psi] = s;
            i++;
        }

        i = 0;
        foreach (Sprite s in archerAttackSprites)
        {
            PlayerSpriteInfo psi = new PlayerSpriteInfo(PlayerClass.Archer, i);
            playerAttackSprites[psi] = s;
            i++;
        }

        i = 0;
        foreach (Sprite s in fighterDefendSprites)
        {
            PlayerSpriteInfo psi = new PlayerSpriteInfo(PlayerClass.Fighter, i);
            playerDefendSprites[psi] = s;
            i++;
        }

        i = 0;
        foreach (Sprite s in mageDefendSprites)
        {
            PlayerSpriteInfo psi = new PlayerSpriteInfo(PlayerClass.Mage, i);
            playerDefendSprites[psi] = s;
            i++;
        }

        i = 0;
        foreach (Sprite s in rogueDefendSprites)
        {
            PlayerSpriteInfo psi = new PlayerSpriteInfo(PlayerClass.Rogue, i);
            playerDefendSprites[psi] = s;
            i++;
        }

        i = 0;
        foreach (Sprite s in archerDefendSprites)
        {
            PlayerSpriteInfo psi = new PlayerSpriteInfo(PlayerClass.Archer, i);
            playerDefendSprites[psi] = s;
            i++;
        }
    }