Пример #1
0
 @Override
 public void forIntersecting(Collider c) {
   Point dist = new Point(c.pos.x - pos.x, c.pos.y - pos.y);
   double distance = dist.magnitude();
   dist.normalize();
   dist.multiply(-100 / ((distance * distance * distance) + 50));
   vel.add(dist);
 }
Пример #2
0
 @Override
 public void forAllOthers(Collider c) {
   Point dist = new Point(c.pos.x - pos.x, c.pos.y - pos.y);
   double distance = dist.magnitude();
   if (distance > 20) {
     dist.normalize();
     dist.multiply(10 / ((distance * distance) + 10));
     vel.add(dist);
   }
 }
Пример #3
0
 public Blob() {
   pos = Point.frand(400, 400);
   clip = new ClipRect(12, 12);
 }
Пример #4
0
 @Override
 public void update() {
   vel.add(Point.frand(0.01, 0.01));
   vel.multiply(0.9);
   super.update();
 }
Пример #5
0
 public void update() {
   pos.add(vel);
 }