Постройте на экране компьютера сектор, который перемещается при нажатии на клавиши перемещения в указанном направлении — Pascal(Паскаль)

uses crt,graph;
var gd,gm:integer;
 
procedure MovePie;
var x,y,x1,y1:integer;
    k:char;
    move:boolean;
begin
x:=300;y:=240;
move:=true;
repeat
if keypressed then
  begin
    k:=readkey;
    if k=#80 then
      begin
        y1:=y;
        x1:=x;
        y:=y+5;
        move:=true;
      end;
    if k=#72 then
      begin
        y1:=y;
        x1:=x;
        y:=y-5;
        move:=true;
      end;
    if k=#77 then
      begin
        y1:=y;
        x1:=x;
        x:=x+5;
        move:=true;
      end;
    if k=#75 then
      begin
        y1:=y;
        x1:=x;
        x:=x-5;
        move:=true;
      end;
  end;
if move then
  begin
   Setcolor(12);
   PieSlice(x1,y1,60,120,50);
   setfillstyle(1,12);
   floodfill(x1,y1-5,12);
   cleardevice;
   PieSlice(x,y,60,120,50);
   setfillstyle(1,12);
   floodfill(x,y-5,12);
   move:=false;
  end;
until k=#27;
end;
begin
gd:=detect;
Initgraph(gd,gm,'');
OutTextXY(200,20,'Uprawlenye strelkami,  Vyhod-Esc');
OutTextXY(250,50,'Press Enter...');
readln;
MovePie;
closegraph
end.

Leave a Comment

− 1 = 3