Sabtu, 26 Desember 2015

Bola Pantul Sederhana




procedure TForm2.Button1Click(Sender: TObject);
var i:char ;
begin
Form2.WindowState := wsMaximized ;
a := false ;
RadioButton1.Top := 0;
RadioButton1.Left := 0 ;
Timer1.Enabled := true ;
end;

procedure TForm2.Timer1Timer(Sender: TObject);
begin
if RadioButton1.Left <= form2.Width - RadioButton1.Width  then begin

if a = false  then begin

RadioButton1.Left := RadioButton1.Left +1;
RadioButton1.Top := RadioButton1.Top +3;

if RadioButton1.Top >= (Form2.Height - RadioButton1.Height) - 20 then
a := true ;

end else begin
RadioButton1.Left := RadioButton1.Left +1;
RadioButton1.Top := RadioButton1.Top -3;

if RadioButton1.Top <= 1 then
a:= false ;

end;

Tidak ada komentar:

Posting Komentar