Program demostrate rebound of ball
Delphi & Pascal (česká wiki)
Category: KMP (Club of young programmers)
Author: Ján Benkovič
web: www.tbteacher.host.sk
Program: Odraz.pas
File exe: Odraz.exe
Author: Ján Benkovič
web: www.tbteacher.host.sk
Program: Odraz.pas
File exe: Odraz.exe
Program demostrate rebound of ball. Ball will has shadow, this make effectively images.
{ ODRAZ.PAS } { Program ako ukazka odrazu lopticky. Lopticka zanechava stopu } { takze tvori zaujimave obrazce. } { } { Datum:16.03.2000 http://www.trsek.com } uses Crt, Graph; var b,a,x2,y2,x1,y1,x,y,i, Gd, Gm: Integer; begin randomize; Gd := Detect; InitGraph(Gd, Gm, ''); if GraphResult <> grOk then Halt(1); x:=random(630); y:=random(470); a:=random(2); b:=random(2); if a=1 then x1:=-4 else x1:=4; if b=1 then y1:=-4 else y1:=4; setcolor(0); repeat PieSlice(x,y,0,360,5); x2:=x; y2:=y; x:=x+x1; y:=y+y1; if x<= 10 then x1:=-x1; if y<= 10 then y1:=-y1; if x>=630 then x1:=-x1; if y>=470 then y1:=-y1; circle(x2,y2,5); until keypressed; CloseGraph; end.