Guest User

Guest User

  • Tech Writer
  • 2
  • 2k

Vector3 Position X animation

Oct 9 2011 7:41 AM
I want to make my vector go right till it hits 300 X and then come back to the point where it started smoothly.
The code I have makes my vector to go smoothly to the right but I cant figure it out why its not going back....

Here is the code :) 

        public override void Update(ref GameTime pGameTime)
        {
            Vector3 tokenPosition = this.PossessedToken.Position;
            tokenPosition.X = tokenPosition.X + 1;
            this.PossessedToken.Position = tokenPosition;

            if (tokenPosition.X > 300)
            {
                Vector3 tokenPosition1 = this.PossessedToken.Position;
                tokenPosition1.X = tokenPosition1.X - 1;
                this.PossessedToken.Position = tokenPosition1;
            }


        }        
        #endregion


Answers (1)