1

Тема: допоможуть зробити рух праворуч(спосіб 2)

PROGRAM TETRIS;
USES
  CRT, GRAPH;
TYPE
  MAS = ARRAY[1 .. 20, 1 .. 10] OF BOOLEAN;
VAR
  x,y,h,gd,gm : integer;
  MovingF : MAS;
  a : char;
  ExitProgram : Boolean;

PROCEDURE MoveLeft(var MovingF : mas);
VAR
  i,j: integer;
BEGIN
  FOR i := 1 TO 20 DO BEGIN
    FOR j := 1 TO 9 DO
      MovingF[i,j] := MovingF[i,j+1];
    MovingF[i,10] := FALSE;

  END;
END;

PROCEDURE MoveRight(MovingF : MAS);
VAR
  i,j : integer;
BEGIN
  FOR i := 1 To 20 DO BEGIN
     FOR j := 9 DOWNTO 1 DO
       MovingF[i,j] := MovingF[i,j+1];

  END;
END;

PROCEDURE MoweDown;
BEGIN

END;

PROCEDURE RotateF;
BEGIN

END;

PROCEDURE CreateF;
BEGIN

END;

PROCEDURE DrawFrame(x,y,h : INTEGER);
BEGIN
  SetColor(15);
  Rectangle(x,y,x + 10 * h,y + 20 * h);
END;

PROCEDURE DrawRectangle(var x,y,h,i,j : integer; ClearF : boolean);
BEGIN
  IF ClearF = TRUE THEN
    SetColor(0)
  ELSE
    SetColor(2);
  Rectangle(x + (j - 1) * h,y + (i - 1) * h,x + j * h,y + i * h);

END;

PROCEDURE DrawMovingF(x,y,h: integer; ClearF: boolean);
var
i,j: integer;
BEGIN
  FOR i := 1 TO 20 DO
    FOR j := 1 TO 10 DO
      IF MovingF[i,j] = TRUE THEN
        DrawRectangle(x,y,h,i,j,ClearF);

END;

PROCEDURE ProcessPressedKey(a: CHAR; x,y,h: Integer);
BEGIN
  CASE a OF
    #80:
      BEGIN



      END;
    #75:
      BEGIN

        DrawMovingF(x,y,h,TRUE);

        MoveLeft(MovingF);
        DrawMovingF(x,y,h,FALSE);
      END;
    #77:
      BEGIN
        DrawMovingF(x,y,h,TRUE);
        MoveRight(MovingF);
        DrawMovingF(x,y,h,FALSE);
      END;
    #72:
      BEGIN

      END;
  END;
END;

BEGIN
  x := 200;
  y := 0;
  h := 24;
  Gd := Detect;
  InitGraph(Gd,Gm,'c:\bp\bgi');
  DrawFrame(x,y,h);
  MovingF[2,6] := true;
  MovingF[2,5] := true;
  DrawMovingF(x,y,h,FALSE);
  DrawFrame(x,y,h);

  WHILE NOT ExitProgram = TRUE DO BEGIN
    a := ReadKey;
    IF a = #27 THEN
      ExitProgram := TRUE
    ELSE
      ProcessPressedKey(a,x,y,h);
  END;

END.

2

Re: допоможуть зробити рух праворуч(спосіб 2)

У вас тут уже є якийсь MoveRight, чим він вас не влаштовує?