New answers tagged xna
1
Myself, I'd attack it a little something like this:
public enum Direction {
Down,
Left,
None,
Right,
Up
}
public static DirectionFromTo(Vector2 from, Vector2 to) {
Vector2 offset = to - from;
Vector2 absolute = new Vector2(Abs(offset.x), Abs(offset.y));
// In your code, it looks like you have a fudge factor to ignore
...
Top 50 recent answers are included
Related Tags
xna × 3076c# × 1396
monogame × 390
xna-4.0 × 324
2d × 258
collision-detection × 189
3d × 156
hlsl × 138
textures × 133
shaders × 117
physics × 98
camera × 91
sprites × 87
models × 75
windows-phone-7 × 75
xna-content-pipeline × 71
rotation × 70
farseer-physics-engine × 70
matrix × 64
mathematics × 59
graphics × 58
directx × 57
spritebatch × 55
lighting × 54
rendering × 52