The following code snippet crops up quite often in my code where collision rectangles need to be calculated:
bullet.collisionRect.X = (int)bullet.position.X; bullet.collisionRect.Y = (int)bullet.position.Y; |
Is there any way round the unboxing/cast? The collision rects are XNA Rectangles, position X, Y are floats (stored in a Vector2).