Beispiel #1
0
        public void LoadContent(GameContent Content)
        {
            selectCursor.PlayAnimation(new Animation(Content.GetUiTexture(5), 0.1f, true));

            /***
             * technically you could have the sprite loaded based on custom input, if you have more than 1 character made
             * and you could load the sprites dynamically like this
             * int sprite_index = 1;
             * string spriteSouthWest = "0" + sprite_index + "_SouthWest";
             * southWestBodyAnimation = new Animation(Content.Load<Texture2D>("Sprites/Characters/Body/"+spriteSouthWest), 0.13f, true);
             ***/
            // Load the spritesheet for each direction
            southWestBodyAnimation = new Animation(Content.GetBodyTexture(1), 0.15f, true);
            southEastBodyAnimation = new Animation(Content.GetBodyTexture(2), 0.15f, true);
            northWestBodyAnimation = new Animation(Content.GetBodyTexture(3), 0.15f, true);
            northEastBodyAnimation = new Animation(Content.GetBodyTexture(4), 0.15f, true);
            // load the head spritesheet
            headAnimation = new Animation(Content.GetHeadTexture(2), 0.1f, false);
            // set the animation to be still for the head, so we can load each frame in it individually
            headAnimation.IsStill = true;

            footstep = Content.GetSoundEffect(1);

            // Calculate bounds within texture size.
            int width  = (int)(southWestBodyAnimation.FrameWidth * 0.4);
            int left   = (southWestBodyAnimation.FrameWidth - width) / 2;
            int height = (int)(southWestBodyAnimation.FrameWidth * 0.8);
            int top    = southWestBodyAnimation.FrameHeight - height;

            localBounds = new Rectangle(left, top, width, height);
        }