well I am working with a small piece of code,for some reason it never gets to label1.Text="true" or label1.Text='false",
const int LEFT = 0;
const int TOP = 0;
const int RIGHT = 5;
const int BOTTOM = 3;
int [] rect1 = new int[4];
int [] rect2 = new int[4];
public bool collideRectRect(int[] rect1, int[] rect2)
{
if (rect1< rect2
||
rect1> rect2
||
rect1[TOP] < rect2[BOTTOM] ||
rect1[BOTTOM] > rect2[TOP])
{
label1.Text = "false";
return false;
}
else
{
label1.Text = "true";
return true;
}
}
perhaps it's because your declaration is incorrect?
const int LEFT = 0;
const int TOP = 0;
const int RIGHT = 5;
const int BOTTOM = 3;
to which means when you access rect1
, you should be either crashing your program, or getting very bad results, accessing left/top will return the same value at the same location.
i assume you want something like this:
const int LEFT = 0;
const int TOP = 1;
const int RIGHT = 2;
const int BOTTOM = 3;