Exemplo n.º 1
0
  private void headFor(Vector2 target) {
    assert Rectangle.contains(movementRect, target);

    Vector2 delta = Vector2.subtract(target, body.getMin());
    Vector2 direction = delta.normalize();
    Vector2 velocity = Vector2.multiply(direction, speed);
    movement.setVelocity(velocity);
  }