コード例 #1
0
        public void LoadContent()
        {
            sup2 = content.Load<Texture2D>("HeroSprite/Gohan1");

            idleAnimation2 = new Animation(sup2, 0.1f, true, 5);
             int positionX = (Level.windowWidth / 2) - (idleAnimation2.FrameWidth / 4);
             int positionY = (Level.windowHeight / 2) - (idleAnimation2.FrameHeight / 4) - 40;
            sup2Position = new Vector2((float)positionX, (float)positionY);
            spriteSup2.PlayAnimation(idleAnimation2);
        }
コード例 #2
0
        public void PlayAnimation(Animation animation)
        {
            if (Animation == animation)
            {
                return;
            }

            this.animation = animation;
            this.frameIndex = 0;
            this.time = 0.0f;
        }
コード例 #3
0
        public void LoadContent()
        {
            player = content.Load<Texture2D>("HeroSprite/Goku1");

            idleAnimation = new Animation(player, 0.1f, true, 6);

            int positionX = (Level.windowWidth / 2) - (idleAnimation.FrameWidth / 4);
            int positionY = (Level.windowHeight / 2) - (idleAnimation.FrameHeight / 4) - 60;
            playerPosition = new Vector2((float)positionX, (float)positionY);

            spritePlayer.PlayAnimation(idleAnimation);
        }
コード例 #4
0
        public void Update(GameTime gameTime)
        {
            sup1 = content.Load<Texture2D>("HeroSprite/Trunks");

                idleAnimation = new Animation(sup1, 0.1f, true, 6);

                int positionX = (Level.windowWidth / 2) - (idleAnimation.FrameWidth / 4);
                int positionY = (Level.windowHeight / 2) - (idleAnimation.FrameHeight / 4) - 60;
                sup1Position = new Vector2((float)positionX, (float)positionY);

                spriteSup1.PlayAnimation(idleAnimation);
        }
コード例 #5
0
        public void Update(GameTime gameTime)
        {
            if(level.mouseState.LeftButton == ButtonState.Pressed && level.oldMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released)
            {
                player = content.Load<Texture2D>("HeroSprite/Goku3");

                idleAnimation = new Animation(player, 0.1f, true, 6);

                int positionX = (Level.windowWidth / 2) - (idleAnimation.FrameWidth / 4);
                int positionY = (Level.windowHeight / 2) - (idleAnimation.FrameHeight / 4) - 80;
                playerPosition = new Vector2((float)positionX, (float)positionY);
                idleAnimation = new Animation(player, 0.1f, false, 6);

                spritePlayer.PlayAnimation(idleAnimation);
            }
        }