Пример #1
0
  public void turnLeft(int degrees) {
    Vector oldVelocity = model.getVelocity();
    double angle = oldVelocity.getAngle();

    Vector newVelocity = Vector.getUnitVector((int) (angle - degrees));
    model.setVelocity(newVelocity.snapTo());
  }
Пример #2
0
 public void forward(int pixels) {
   Vector oldVelocity = model.getVelocity();
   Vector newVelocity = oldVelocity.scale(pixels);
   model.setVelocity(newVelocity);
   model.step();
 }