Now, I'm doing this to test collision detection. Heres the bit of code that doesn't work:
if(Sprite1box.Right == Sprite2box.Left)
{
Sprite1pos.X += 5;
Sprite1box.X += 5;
}
(Where Sprite1box = The rectangle aroudn the first sprite, Sprite2box = the rectangle around the 2nd sprite, and Sprite1pos is the vector of the 1st sprite)
This doesn't work - the sprite just moves right through the second sprite.
Now, I figured I must've done something wrong with the rectangles. But when I do:
if (Sprite1box.Bottom == Sprite2box.Top)
{
Sprite1pos.Y += -5;
Sprite1box.Y += -5;
}
It runs fine; the sprite doesn't go below the top of the Sprite2box.
What's wrong
