Game Development Reference
In-Depth Information
if (y1 >= y2){
yb = y1;
ys = y2;
yFlag = false ;
}
else {
yb = y2;
ys = y1;
yFlag = true ;
}
if (xFlag == true ){
width = w1;
}
else {
width = w2;
}
if (yFlag == true ){
height = h1;
}
else {
height = h2;
}
//Checks whether the overlapped area is larger than the given threshold
if (xb >= xs && xb <= xs+width-1 && yb >= ys && yb <= ys+height-1){
double dWidth = width-xb+xs;
double dHeight = height-yb+ys;
if (dWidth*dHeight/(w2*h2) >= OVERLAP){
return true ;
}
}
return false ;
}
The process of collision detection also includes screen bound check and impassable path
matrix check.
Search WWH ::




Custom Search