   Tracking offscreen objects in a top-down 2d XNA game
  Hey all,I'm trying out XNA and I'm having a great deal of difficulty with a conceptual problem. I'm making a simple top-down 2D shooter, but I'm having real difficulty trying to figure out how to handle the screen coordinates vs. world coordinates issue. I can't seem to be able to translate between the coordinates of the word, and the coordinates of the screen. How do you do it? I want my objects to be able to fly around a world much larger than my screen, but how do I get my screen to "appear" like a window into this other world?Thanks, - Goishin   
  This is quite difficult to explain, but quite easy to do.First of all the world and any windows into it need to have independent coordinate systems. Then you just have to do some transformations to figure out the position in one coordinate system of a point in another. It may help the understanding to use intermediate coordinate systems, but they are not necessary.The coordinate transformation will be just an offset and a scaling factorscreenpos = (worldpos - offset)*scaleFor the sake of example, let's assume that we have determined that right now the screen origin is at 57,83 in world space. Let's say that one world space unit (a meter) appears as 32 screen space units (pixels). Then if we have an object at 60,85 in world space, its screen space position can be calculated like so:screenx = (60 - 57) * 32 = 96screeny = (85 - 83) * 32 = 64Before you do that transformation, you should determine whether the object is even on-screen.I hope this helps you, good luck.   