public void turnLeft(int degrees) { Vector oldVelocity = model.getVelocity(); double angle = oldVelocity.getAngle(); Vector newVelocity = Vector.getUnitVector((int) (angle - degrees)); model.setVelocity(newVelocity.snapTo()); }
public void forward(int pixels) { Vector oldVelocity = model.getVelocity(); Vector newVelocity = oldVelocity.scale(pixels); model.setVelocity(newVelocity); model.step(); }