예제 #1
0
 /**
  * 判断两个精灵是否发生碰撞并处理
  *
  * @param group 精灵组
  * @return re 是否发生碰撞
  */
 public boolean collision(CollisionGroup group) {
   final boolean re = group.getSp1().getRect().isCollide(group.getSp2().getRect());
   // Log.i("rrrrrrrrr",""+group.getSp1().getRect()+group.getSp2().getRect());
   if (re) {
     final CollisionEvent event = new CollisionEvent(this, group);
     handleCollisionEvent(event);
   }
   return re;
 }
 /**
  * @return dfldskjlgj
  * @param obj dsf
  */
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (getClass() != obj.getClass()) {
     return false;
   }
   final CollisionGroup other = (CollisionGroup) obj;
   if (this.sp1 == other.getSp1() && this.sp2 == other.getSp2()) {
     return true;
   }
   if (this.sp1 == other.getSp2() && this.sp2 == other.getSp1()) {
     return true;
   }
   return false;
 }