Example #1
0
 public boolean hitWall(Wall w) {
   if (this.isLive() && this.getRect().intersects(w.getRect())) {
     this.live = false;
     return true;
   }
   return false;
 }
Example #2
0
 // 碰撞测试判断,是否与墙撞了
 public boolean collidesWithWall(Wall w) {
   if (this.tlive && this.getRect().intersects(w.getRect())) {
     this.stay();
     return true;
   }
   ;
   return false;
 }