Текст программы: program gibo; uses crt,graph; Label 1,2, Mylabel; var Key:Char; r,r2,i:integer; Xk1,Xk2,Yk1,Yk2,Xp,Yp:integer; Xv1,Xv2,Yv1,Yv2,Xv,Yv :integer; gd,gm:integer; procedure Vrag; Begin randomize; Xv1:=Random(600); Xv2:=Xv1+40; Yv1:=-200;; Yv2:=-160; r2:=20; rectangle (Xv1,Yv1,Xv2,Yv2); Circle(Xv1+r2,Yv1+r2,r2); Line(Xv1+r2,Yv1+r2,Xv1+r2,Yv2+r2); Repeat Yv1:=Yv1+5; Yv2:=Yv2+5; Xv1:=Xv1; Xv2:=Xv2; Setcolor(Green); rectangle (Xv1,Yv1,Xv2,Yv2); Circle(Xv1+r2,Yv1+r2,r2); Line(Xv1+r2,Yv1+r2,Xv1+r2,Yv2+r2); Delay(13000); Yv1:=Yv1; Yv2:=Yv2; R2:=20; Xv1:=Xv1; Xv2:=Xv2; Setcolor(White); rectangle (Xv1,Yv1,Xv2,Yv2); Circle(Xv1+r2,Yv1+r2,r2); Line(Xv1+r2,Yv1+r2,Xv1+r2,Yv2+r2); Until Yv1>500; setcolor(Green); end; Procedure Tank; Begin Xk1:=180; Xk2:=220; Yk1:=420; Yk2:=460; r:=20; setcolor(Green); rectangle(Xk1,Yk1,Xk2,Yk2); Circle(Xk1+r,Yk1+r,r); Line(Xk1+r,Yk1-r,Xk1+r,Yk2-r); vrag; end; procedure Boom; Begin R:=20; Xp:=Xk1+r; Yp:=Yk2-r; repeat Xp:=Xp; Yp:=Yp-45; setcolor(4); Circle(Xp,Yp,3); Delay(2000); Xp:=Xp; Yp:=Yp; setcolor(white); Circle(Xp,Yp,3); Until Yp<0; sound(300);delay(150); setcolor(green); end; procedure Up; begin Xk1:=Xk1; Yk1:= Yk1-20; Xk2:=Xk2; Yk2:=Yk2-20; r:=20; ClearViewPort; rectangle(Xk1,Yk1,Xk2,Yk2); Circle(Xk1+r,Yk1+r,r); Line(Xk1+r,Yk1-r,Xk1+r,Yk2-r); repeat key:=readkey; if key='5' then Boom; until key<>'5'; end; procedure Left; begin Xk1:=Xk1-20; Yk1:= Yk1; Xk2:=Xk2-20; Yk2:=Yk2; r:=20; ClearViewPort; rectangle(Xk1,Yk1,Xk2,Yk2); Circle(Xk1+r,Yk1+r,r); Line(Xk1-r,Yk1+r,Xk1+r,Yk2-r); end; procedure Right; begin Xk1:=Xk1+20; Yk1:= Yk1; Xk2:=Xk2+20; Yk2:=Yk2; r:=20; ClearViewPort; rectangle(Xk1,Yk1,Xk2,Yk2); Circle(Xk1+r,Yk1+r,r); Line(Xk1+r+2*r,Yk1+r,Xk1+r,Yk2-r); end; procedure Down; begin Xk1:=Xk1; Yk1:= Yk1+20; Xk2:=Xk2; Yk2:=Yk2+20; r:=20; ClearViewPort; rectangle(Xk1,Yk1,Xk2,Yk2); Circle(Xk1+r,Yk1+r,r); Line(Xk1+r,Yk1+r,Xk1+r,Yk2+r); end; begin gd:=detect; initgraph(gd,gm,'c:/tp7'); SetBkColor(15); tank; repeat; key:=readkey; if key='8' then Begin Up; if key='5' then Boom; end; if key='4' then Left else if key='6' then Right else if key='2' then Down; if key='9' then Vrag; until key='0'; readln; readln; end.
|