I'm learning some XNA game programming in C#. I've learned a bit, but still have some basic questions about navigating the screen. When you make a Rectangle object the arguements are X,Y, Width, Height. When this is drawn to the screen X,Y coordinates are for the top left corner, and width and height are width and height of the rectangle. This basically tells you where the image will be drawn on the grid, but how? Must be something in the draw function that takes care of it?
I guess that's not my biggest question though. When you create a basic sprite with a Texture2D, a Vector2 marking Location, and Vector2 marking size this is basically making a Rectangle to graph in the same way, but what's going on in that sense? Lol...I'm quite confused about it, but think it's necissary to get a better understanding of the screen and system..
I can do basic box collision by setting two sprites values into a Rectangle object and using the intersect method on the objects corner point and dimensions but how can I recreate this using the sprite's own dimensions via data members?
wouldn't sprite1.Postion.X + sprite1Size.X be the upper edge?
I tried a few things like
sprite1.Postion.X + sprite1Size.X < sprite2.Postion.X + sprite2Size.X
and various other XY combinations and inequalities, but it didn't seem to be matching to the sprite's boxes, as they didn't have to collide to trigger a reaction, lol
Thanks in advance for any help.
Edited by JeremyB, 31 January 2014 - 10:52 AM.