示例#1
0
        public void LoadContent()
        {
            if (characterChooser == 0)
            {
                player = content.Load<Texture2D>("Hero sprite/linkidle");
                player2 = content.Load<Texture2D>("Hero sprite/linkslash");

                backAnimation = new Animation(player, 0.1f, true, 3);
                frontAnimation = new Animation(player2, 0.1f, true, 3);
            }
            else if (characterChooser == 1)
            {
                player = content.Load<Texture2D>("Hero sprite/ganonidle");
                player2 = content.Load<Texture2D>("Hero sprite/ganonatk");

                backAnimation = new Animation(player, 0.1f, true, 4);
                frontAnimation = new Animation(player2, 0.1f, true, 4);
            }

            int positionX = (windowWidth / 3 ) - (player.Width /-1);
            int positionY = (windowHeight / 2) - (player.Height / -1);
            playerPosition = new Vector2((float)positionX, (float)positionY);

            spritePlayer.PlayAnimation(backAnimation);
        }
        public void PlayAnimation(Animation animation)
        {
            if (Animation == animation)
            {
                return;
            }

            this.animation = animation;
            this.frameIndex = 0;
            this.time = 0.0f;
        }