Составьте программу вывода на экран стилизованной бабочки. При нажатии клавиши Enter она начинает полет, взмахивая крыльями — Pascal(Паскаль)

Program lab13_9;
uses crt,Graph;
var
Gd,Gm,x,y:Integer;
a,a0:real;
P:Pointer;
mark:boolean;
Kod:char;
procedure show(n:real);
begin
Ellipse(x+80+round(abs(n*30)), y+100, 255, 180, round(abs(n*30)), 50);
Ellipse(x+80+round(abs(n*15)), y+170, 180, 70, round(abs(n*15)), 25);
Ellipse(x+60-round(abs(n*30)), y+100, 0, 295, round(abs(n*30)), 50);
Ellipse(x+60-round(abs(n*15)), y+170, 120, 360,round(abs(n*15)), 25);
end;
 
begin
  Gd := Detect;
  InitGraph(Gd, Gm, 'c:\bp\bgi');
  if GraphResult <> grOk then
    Halt(1);
  SetColor(yellow);
  Ellipse(320,240,0,360,8,60);
  Circle(320,171,8);
  MoveTo(313,165);
  LineRel(-30,-30);
  Circle(281,132,2);
  MoveTo(327,165);
  LineRel(30,-30);
  Circle(359,132,2);
  MoveTo(316,188);
  LineRel(8,0);
  MoveTo(314,199);
  LineRel(12,0);
  MoveTo(314,216);
  LineRel(13,0);
  MoveTo(313,232);
  LineRel(15,0);
  MoveTo(313,248);
  LineRel(15,0);
  MoveTo(314,264);
  LineRel(12,0);
  MoveTo(314,281);
  LineRel(12,0);
  MoveTo(316,292);
  LineRel(8,0);
  x:=250;
  y:=120;
  mark:=true;
  GetMem(P,40);
  a:=Pi/2;
  a0:=0;
  show(sin(a));
  repeat
    Kod:=readkey;
  until kod=#13;
  repeat
  a:=a+a0;
     if a>pi/3 then a0:=-0.1;
     if a<pi/18 then a0:=0.1;
  setcolor(3);
  show(sin(a));
  delay(3000);
  setcolor(0);
  show(sin(a));
  GetImage(x,y,x+140,y+200, P^);
  if y=2 then
    mark:=false;
  if y=280 then
    mark:=true;
  if mark=true then
    y:=y-2;
  if mark=false then
    y:=y+2;
  cleardevice;
  PutImage(x,y,P^,NormalPut);
  until keypressed;
  Readln;
  CloseGraph;
end.

Leave a Comment

96 − = 95