Class<?> b1;
b1 = GS.scr_check_freebox(x, y-GS.ss, this);
if ( b1.getClass().equals(BLK.class) || b1.getClass().equals(STN.class) )
{
if (b1.falling == true)
{
scr_cascade_fall(scr_check_freebox(x, y-GS.ss, this));
return (true);
}
}
The function "scr_get_freebox" searches through all instances of BLK and STN and returns the first one it finds that exists wholly or partially inside a box with upper-left corner of the coordinate you pass it, but it will exclude from it's search the "this" that you pass it. It's not really important except that it returns either null or an instance of BLK or an instance of STN.
Giving error on line 5 where is says "if (b1.falling == true)" The thing is, both those classes (BLK and STN) have a boolean variable called falling. The compiler is just being dumb here.
How do i get rid of this error? Is there a special way to use getClass() or instanceof ?