Is there an easy way to invert a number in C# with a function?
I’m using XNA and i’d like to tell my program that if my ‘variable’ gets beyond a certain number it has to invert it’s value.
The whole point is to give a rebound effect.
if (ballPosition.X >= screenWidth)
{
// Invert the ball Direction Vector.X
}
Just whack a
-sign in front of it: