예제 #1
0
파일: Entity.java 프로젝트: kgroat/Immunity
 public final boolean collides(Entity other) {
   return other.dist(this) < radius + other.radius;
 }
예제 #2
0
파일: Entity.java 프로젝트: kgroat/Immunity
 // changes the direction of an object calling this function by checking to
 // see whether a new direction will get it closer to the heading that it wants;
 // double t is the current heading
 private boolean isCloser(double t) {
   double dx = Math.cos(theta) * targetVel, dy = Math.sin(theta) * targetVel;
   double tdx = Math.cos(t) * targetVel, tdy = Math.sin(t) * targetVel;
   return target.dist(x + dx, y + dy) > target.dist(x + tdx, y + tdy);
 }
예제 #3
0
파일: Entity.java 프로젝트: kgroat/Immunity
 public Helper.Intersection intersectPoint(Entity other) {
   return Helper.intersectPoint(getBounds(), other.getBounds());
 }