Help to understand directions of sprites in XNA
- by 3Dkreativ
If I want to move a sprite to the right and upwards in a 45 degree angle I use
Vector2 direction = new Vector2(1,-1);
And if the sprite should move straight to right
Vector2 direction = new Vector2(1,0);
But how would I do if I want another directions, lets say somewhere between this values? I have tested with some other values, but then the sprite either moves to fast and or in another direction than I expected!? I suspect it's about normalize!? Another thing I have problem with to understand.
I'm doing a simple asteroids game as a task in a class in C# and XNA. When the asteroids hit the window borders, I want them to bounce back in a random direction, but I can't do this before I understand how directions and Vector2 works. Help is preciated! Thanks!