So I've written a statement for releasing the ball based on a certain speed and for it to move in the direction of the mouse, like so:
MouseX = stateOfTheMouse.X; MouseY = stateOfTheMouse.Y; difference = Vector2.Subtract(position, new Vector2(MouseX, MouseY)); direction = Vector2.Normalize(difference); velocity.X -= ((float)(usedSpeed / 2)); velocity.Y -= ((float)(usedSpeed / 2));
Then in my updateI call this
position += velocity * direction;
I assign usedSpeed as an integer with the press of a NumPad key 1-5 each on reflects the speed amount hence NumPad1 = speed of 1, etc.
Therefore, how would I make the velocity decelerate and slow down to a complete stop?