Example #1
0
 /** Whether X and Y pointer is inside object */
 public boolean isOverlap(int X, int Y) {
   if (absolute) {
     return ((InsUtil.Absolute(X - this.getMiddleX()) <= (this.size.width / 2))
         && (InsUtil.Absolute(Y - this.getMiddleY()) <= (this.size.height / 2)));
   } else {
     return ((InsUtil.Absolute((X - this.camera.position.x) - this.getMiddleX())
             <= (this.size.width / 2))
         && (InsUtil.Absolute((Y - this.camera.position.y) - this.getMiddleY())
             <= (this.size.height / 2)));
   }
 }
Example #2
0
 public void handle() {
   if (this.isValid()) {
     if (!this.group1.deleted && !this.group2.deleted) {
       InsBasic obj1;
       InsBasic obj2;
       for (int i = 0; i < this.group1.members.size(); i++) {
         obj1 = (InsBasic) this.group1.members.elementAt(i);
         if ((obj1 != null) && obj1.exists && obj1.alive) {
           for (int j = 0; j < this.group2.members.size(); j++) {
             obj2 = (InsBasic) this.group2.members.elementAt(j);
             if ((obj2 != null) && obj2.exists && obj2.alive) {
               if (InsUtil.isCollide(obj1, obj2, this.type)) {
                 this.callback.call(obj1, obj2);
               }
             }
           }
         }
       }
     }
   }
 }
Example #3
0
 /**
  * Check whether the object is currently on screen camera
  *
  * @return TRUE if the object is on screen
  */
 public boolean isOnScreen() {
   return InsUtil.isCollideBox(this, this.camera);
 }