Game Development Reference
In-Depth Information
boolean collisionDetect = false;
if
( invinciBagel.iBagel.spriteFrame. getBoundsInParent() . intersects (
object .getSpriteFrame(). getBoundsInParent() ) ) {
Shape intersection =
SVGPath. intersect (invinciBagel.iBagel.getSpriteBound(),
object .getSpriteBound());
if
(intersection. getBoundsInLocal().getWidth() != -1 ) {
collisionDetect = true ;
}
}
if( collisionDetect ) {
invinciBagel.playiSound0();
return true ;
}
return false ;
}
Figure 16-32 . Creating the basic collision detection code and testing it using the invinciBagel.playiSound0() method
call
 
Search WWH ::




Custom Search