コード例 #1
0
        private void UpdatePosition()
        {
            Velocity += Acceleration * time.DeltaTime;

            if (Vector2fLibrary.GetMagnitude(Velocity * time.DeltaTime) > MaxVelocity)
            {
                Velocity = Vector2fLibrary.SetMagnitude(Velocity, MaxVelocity / time.DeltaTime);
            }

            Shape.Position += Velocity * time.DeltaTime;
        }
コード例 #2
0
        private void UpdateVelocity(Random rd)
        {
            //Acceleration += new Vector2f((float)(rd.NextDouble() * 2 - 1), (float)(rd.NextDouble() * 2 - 1));

            Velocity += Acceleration /** time.DeltaTime*/;

            double magnitude = Vector2fLibrary.GetMagnitude(Velocity);

            if (magnitude > velocityLimit)
            {
                Velocity = Vector2fLibrary.SetMagnitude(Velocity, velocityLimit);
            }

            Shape.Position += Velocity * time.DeltaTime;
        }