Content
program Bintang; uses crt, graph; type Tbintang = Record PX, PY : Integer; Ukuran : Integer; Warna : Integer; end; Var BT : TBintang; Procedure Create_Bintang(Var B:Tbintang;X, Y, U, W: Integer); begin B.PX := X; B.PY := Y; B.Ukuran := U; B.Warna := W; setcolor(B.Warna); Moveto(B.PX, B.PY-4*B.Ukuran); Lineto(B.PX+1*B.Ukuran, B.PY-1*B.Ukuran); LineTo(B.PX+4*B.Ukuran, B.PY-1*B.Ukuran); LineTo(B.PX+2*B.Ukuran, B.PY+1*B.Ukuran); LineTo(B.PX+3*B.Ukuran, B.PY+4*B.Ukuran); Lineto(B.PX, B.PY+2*B.Ukuran); LineTo(B.PX-3*B.Ukuran, B.PY+4*B.Ukuran); LineTo(B.PX-2*B.Ukuran, B.PY+1*B.Ukuran); Lineto(B.PX-4*B.Ukuran, B.PY-1*B.Ukuran); LineTo(B.PX-1*B.Ukuran, B.PY-1*B.Ukuran); Lineto(B.PX, B.PY-4*B.Ukuran); end; procedure InisialisasiGrafik; var DriverGrafik,ModeGrafik : integer; begin DriverGrafik:=VGA; ModeGrafik:=VGAHi; initgraph(DriverGrafik,ModeGrafik,' '); end; Begin clrscr; InisialisasiGrafik; Repeat BT.PX :=(315); BT.PY :=(200); BT.Ukuran := Random(30); BT.Warna := (green); Create_Bintang(BT, BT.PX, BT.PY, BT.Ukuran, BT.Warna); delay(10000); until keypressed; readln; closegraph End.
Tidak ada komentar :
Posting Komentar