Membuat Animasi Ufo di delphi 7

        Membuat Program Ufo di delphi 7

Baca juga : Membuat Garis Threeleaf di delphi 7

Berikut Merupakan Langkah-langkah membua program animasi Ufo di delphi 7 :



1. Siapkan 1 Tpanel

2. 1 Timer

3. 1. shape/bentuk ofal 

4. Kemudian  Masukan Coding di bawah ini:

klik 2 kali pada Timer lalu masukan coding

procedure TForm1.Timer1Timer(Sender: TObject); 

var x,y,pencacah:integer; 

begin randomize;

 x:=random(panel1.width);

 y:=random(panel1.height); 

pencacah:=random(2);

 x:=x+1;y:=y+1; if pencacah=1 then begin

 if ((ufo.left)<=(panel1.Width-ufo.Width)) then

 ufo.left:=ufo.left+trunc(10*sin(x/y)) 

else 

ufo.left:=ufo.left-trunc(10*cos(x/y));

 if ((ufo.top)<=(panel1.height-ufo.height)) then

 ufo.top:=ufo.top+trunc(10*sin(y/x)) 

else ufo.top:=ufo.top-trunc(10*cos(y/x)); 

end;

 if pencacah=0 then if (ufo.left>0) then if (ufo.top>0) then

 begin

 if ((ufo.left)<=(panel1.Width-ufo.Width)) then 

ufo.left:=ufo.left-trunc(10*sin(x/y)) else ufo.left:=ufo.left-trunc(10*cos(x/y));

 if ((ufo.top)<=(panel1.height-ufo.height)) then

 ufo.top:=ufo.top-trunc(10*sin(y/x)) else ufo.top:=ufo.top-trunc(10*cos(y/x));

 end; 

end;

 end.


Demikianlah cara membuat program animasi Ufo. selamat mencoba semoga berhasil.

Jangan lupa ikuti terus informasi dan berita terupdate di blog herawan09.blogspot.com. sampai bertemu di konten selanjutnya brody.



0 Comments:

Posting Komentar