| Introduction to OOP | Chapter 7: A Billiards Game: | next | previous | audio | real | text |
procedure TfrmGraphics.DoClick (Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
bptr : TBall;
begin
cueBall.energy := 20.0;
cueBall.setDirection(hitAngle(cueBall.x - x, cueBall.y - y));
{ then loop as long as called for }
ballMoved := true;
while ballMoved do begin
ballMoved := false;
bptr := listOfBalls;
while bptr <> nil do begin
bptr.update;
bptr := bptr.link;
end;
end;
end;