0

I can not decipher your code without runnable version to test, but here is the last version of my playing with my Lazarus code. It has not all pieces and only rotation hard coded in procedure without shadowing the current buffer for collision detection.

I attach that as zip file.

Maybe you like this, so you do not worry about shadowing the screen contents (from Turbo Pascal FAQ):
Q: How can I read a text character from the screen (e.g. xy 5,2)?

A: The code for the task is given below

Uses Dos;
  (* Read an individual character from the screen *)
  function VDCHXYFN (column, row : byte) : char;
  var regs : registers;
      videocolumns : byte;
      videobase : word;
      offset : word;
  begin
    { Get the video base address }
    FillChar (regs, SizeOf(regs), 0);
    regs.ah := $0F;  Intr ($10, regs);
    if regs.al = 7 then videobase := $B000 else videobase := $B800;
    {}
    { Get the screen width }
    FillChar (regs, SizeOf(regs), 0);
    regs.ah := $0F;
    Intr ($10, regs);
    videocolumns := regs.ah;
    {}
    { Get the character }
    offset := (((row-1)*videocolumns)+(column-1))*2;
    vdchxyfn := chr(mem[videobase:offset]);
  end;  (* vdchxyfn *)

  begin
     writeln ('Character at 5, 2 is ascii ', Ord(VDCHXYFN(5,2)));
  end.

--------------------------------------------------------------------

Edited by pyTony: n/a

0

i dont know how to open it... i placed a text document with the source... (sorry about the comm, they are in my country language...)

Attachments
uses crt,dos;
var tip,x,y,x1,y1,x2,y2,jbyte;
    counter,i,speed,maxword;
    lovit,linie,gmaxboolean;
    zinteger;
    ftext;
    cchar;
    regsregisters ;
    cagearray[0..100,0..100] of byte;
                                                         {--desenarea celor 7 obiecte}
procedure showtime0(j,a,b word);
begin case j of
       0 begin gotoxy(a,b);     Write('');
                gotoxy(a,b+1);   Write('');
                gotoxy(a,b+2);   Write('');
                cage[b,a]=1;
                cage[b+1,a]=1;
                cage[b+2,a]=1;                      {gotoxy(col,lin) si matrix[lin,col]}
                cage[b+2,a+1]=1;
          end;
       1 begin b=b+1;
                gotoxy(a,b);     Write('');
                gotoxy(a,b+1);   Write('');
                cage[b,a]=1;
                cage[b,a+1]=1;
                cage[b,a+2]=1;
                cage[b+1,a]=1;
          end;
       2 begin gotoxy(a,b);     Write('');
                gotoxy(a+1,b+1); Write('');
                gotoxy(a+1,b+2); Write('');
                cage[b,a]=1;
                cage[b,a+1]=1;
                cage[b+1,a+1]=1;
                cage[b+2,a+1]=1;
          end;
       3 begin b=b+2;
                gotoxy(a,b);     Write('');
                gotoxy(a+2,b-1); Write('');
                cage[b,a]=1;
                cage[b,a+1]=1;
                cage[b,a+2]=1;
                cage[b-1,a+2]=1;
          end;
       end;
       regs.ax=$0100;  {-stergerea cursorului}
       regs.cl=$20;
       regs.ch=$20;
       intr($10,regs);  {stergerea cursorului-}
end;

procedure showtime1(j,a,b word);
begin case j of
       0 begin gotoxy(a+1,b);     Write('');
                gotoxy(a+1,b+1);   Write('');
                gotoxy(a,b+2);     Write('');
                cage[b,a+1]=1;
                cage[b+1,a+1]=1;
                cage[b+2,a]=1;
                cage[b+2,a+1]=1;
          end;
       1 begin b=b+1;
                gotoxy(a,b);       Write('');
                gotoxy(a,b-1);     Write('');
                cage[b,a]=1;
                cage[b,a+1]=1;
                cage[b,a+2]=1;
                cage[b-1,a]=1;
          end;
       2 begin gotoxy(a,b);       Write('');
                gotoxy(a,b+1);     Write('');
                gotoxy(a,b+2);     Write('');
                cage[b,a]=1;
                cage[b,a+1]=1;
                cage[b+1,a]=1;
                cage[b+2,a]=1;
          end;
       3 begin b=b+2;
                gotoxy(a,b);       Write('');
                gotoxy(a+2,b+1);   Write('');
                cage[b,a]=1;
                cage[b,a+1]=1;
                cage[b,a+2]=1;
                cage[b+1,a+2]=1;
          end;
       end;
       regs.ax=$0100;
       regs.cl=$20;
       regs.ch=$20;
       intr($10,regs);
end;

procedure showtime2(j,a,b word);
begin case j of
       0 begin a=a+1;
                gotoxy(a,b);     Write('');
                gotoxy(a,b+1);   Write('');
                gotoxy(a,b+2);   Write('');
                cage[b,a]=1;
                cage[b+1,a]=1;
                cage[b+1,a+1]=1;
                cage[b+2,a]=1;
          end;
       3 begin b=b+1;
                gotoxy(a,b);       Write('');
                gotoxy(a+1,b-1);   Write('');
                cage[b,a]=1;
                cage[b,a+1]=1;
                cage[b,a+2]=1;
                cage[b-1,a+1]=1;
          end;
       2 begin gotoxy(a+1,b);     Write('');
                gotoxy(a,b+1);     Write('');
                gotoxy(a+1,b+2);   Write('');
                cage[b,a+1]=1;
                cage[b+1,a]=1;
                cage[b+1,a+1]=1;
                cage[b+2,a+1]=1;
          end;
       1 begin b=b+1;
                gotoxy(a,b);       Write('');
                gotoxy(a+1,b+1);   Write('');
                cage[b,a]=1;
                cage[b,a+1]=1;
                cage[b,a+2]=1;
                cage[b+1,a+1]=1;
          end;
       end;
       regs.ax=$0100;
       regs.cl=$20;
       regs.ch=$20;
       intr($10,regs);
end;

procedure showtime3(j,a,b word);
begin case j of
       0 begin gotoxy(a,b);       Write('');
                gotoxy(a,b+1);     Write('');
                gotoxy(a,b+2);     Write('');
                gotoxy(a,b+3);     Write('');
                gotoxy(a,b+4);     Write('');
                cage[b,a]=1;
                cage[b+1,a]=1;
                cage[b+2,a]=1;
                cage[b+3,a]=1;
                cage[b+4,a]=1;
          end;
       1 begin b=b+2;
                gotoxy(a-2,b);     Write('');
                cage[b,a-2]=1;
                cage[b,a-1]=1;
                cage[b,a]=1;
                cage[b,a+1]=1;
                cage[b,a+2]=1;
          end;
       end;
       regs.ax=$0100;
       regs.cl=$20;
       regs.ch=$20;
       intr($10,regs);
end;

procedure showtime4(a,b word);
begin gotoxy(a,b);     Write('');
      gotoxy(a,b+1);   Write('');
      cage[b,a]=1;
      cage[b,a+1]=1;
      cage[b+1,a]=1;
      cage[b+1,a+1]=1;
      regs.ax=$0100;
      regs.cl=$20;
      regs.ch=$20;
      intr($10,regs);
end;

procedure showtime5(j,a,b word);
begin case j of
       0 begin gotoxy(a,b);       Write('');
                gotoxy(a,b+1);     Write('');
                gotoxy(a+1,b+2);   Write('');
                cage[b,a]=1;
                cage[b+1,a]=1;
                cage[b+1,a+1]=1;
                cage[b+2,a+1]=1;
          end;
       1 begin b=b+1;
                gotoxy(a+1,b);     Write('');
                gotoxy(a,b+1);     Write('');
                cage[b,a+1]=1;
                cage[b,a+2]=1;
                cage[b+1,a]=1;
                cage[b+1,a+1]=1;
          end;
      end;
       regs.ax=$0100;
       regs.cl=$20;
       regs.ch=$20;
       intr($10,regs);
end;

procedure showtime6(j,a,b word);
begin case j of
       0 begin gotoxy(a+1,b);     Write('');
                gotoxy(a,b+1);     Write('');
                gotoxy(a,b+2);     Write('');
                cage[b,a+1]=1;
                cage[b+1,a]=1;
                cage[b+1,a+1]=1;
                cage[b+2,a]=1;
          end;
       1 begin b=b+1;
                gotoxy(a,b);       Write('');
                gotoxy(a+1,b+1);   Write('');
                cage[b,a]=1;
                cage[b,a+1]=1;
                cage[b+1,a+1]=1;
                cage[b+1,a+2]=1;
          end;
      end;
       regs.ax=$0100;
       regs.cl=$20;
       regs.ch=$20;
       intr($10,regs);
end;

procedure undraw0(j,a,b word);                        {---stergerea celor 7 obiecte}
begin case j of
       0 begin gotoxy(a,b);           Write(' ');
                gotoxy(a,b+1);         Write(' ');
                gotoxy(a,b+2);         Write('  ');
                cage[b,a]=0;
                cage[b+1,a]=0;
                cage[b+2,a]=0;                      {gotoxy(col,lin) si matrix[lin,col]}
                cage[b+2,a+1]=0;
          end;
       1 begin b=b+1;
                gotoxy(a,b);           Write('   ');
                gotoxy(a,b+1);         Write(' ');
                cage[b,a]=0;
                cage[b,a+1]=0;
                cage[b,a+2]=0;
                cage[b+1,a]=0;
          end;
       2 begin gotoxy(a,b);           Write('  ');
                gotoxy(a+1,b+1);       Write(' ');
                gotoxy(a+1,b+2);       Write(' ');
                cage[b,a]=0;
                cage[b,a+1]=0;
                cage[b+1,a+1]=0;
                cage[b+2,a+1]=0;
          end;
       3 begin b=b+2;
                gotoxy(a,b);           Write('   ');
                gotoxy(a+2,b-1);       Write(' ');
                cage[b,a]=0;
                cage[b,a+1]=0;
                cage[b,a+2]=0;
                cage[b-1,a+2]=0;
          end;
      end;
end;

procedure undraw1(j,a,b word);
begin case j of
       0 begin gotoxy(a+1,b);         Write(' ');
                gotoxy(a+1,b+1);       Write(' ');
                gotoxy(a,b+2);         Write('  ');
                cage[b,a+1]=0;
                cage[b+1,a+1]=0;
                cage[b+2,a]=0;
                cage[b+2,a+1]=0;
          end;
       1 begin b=b+1;
                gotoxy(a,b);           Write('   ');
                gotoxy(a,b-1);         Write(' ');
                cage[b,a]=0;
                cage[b,a+1]=0;
                cage[b,a+2]=0;
                cage[b-1,a]=0;
          end;
       2 begin gotoxy(a,b);           Write('  ');
                gotoxy(a,b+1);         Write(' ');
                gotoxy(a,b+2);         Write(' ');
                cage[b,a]=0;
                cage[b,a+1]=0;
                cage[b+1,a]=0;
                cage[b+2,a]=0;
          end;
       3 begin b=b+2;
                gotoxy(a,b);           Write('   ');
                gotoxy(a+2,b+1);       Write(' ');
                cage[b,a]=0;
                cage[b,a+1]=0;
                cage[b,a+2]=0;
                cage[b+1,a+2]=0;
          end;
      end;
end;

procedure undraw2(j,a,b word);
begin case j of
       0 begin a=a+1;
                gotoxy(a,b);         Write(' ');
                gotoxy(a,b+1);       Write('  ');
                gotoxy(a,b+2);       Write(' ');
                cage[b,a]=0;
                cage[b+1,a]=0;
                cage[b+1,a+1]=0;
                cage[b+2,a]=0;
          end;
       3 begin b=b+1;
                gotoxy(a,b);           Write('   ');
                gotoxy(a+1,b-1);       Write(' ');
                cage[b,a]=0;
                cage[b,a+1]=0;
                cage[b,a+2]=0;
                cage[b-1,a+1]=0;
          end;
       2 begin gotoxy(a+1,b);         Write(' ');
                gotoxy(a,b+1);         Write('  ');
                gotoxy(a+1,b+2);       Write(' ');
                cage[b,a+1]=0;
                cage[b+1,a]=0;
                cage[b+1,a+1]=0;
                cage[b+2,a+1]=0;
          end;
0

Your file looks garbled, right in beginning definition does not make sense:

var tip,x,y,x1,y1,x2,y2,jbyte;
    counter,i,speed,maxword;
    lovit,linie,gmaxboolean;
    zinteger;
    ftext;
    cchar;
    regsregisters ;
    cagearray[0..100,0..100] of byte;
                                                         {--desenarea celor 7 obiecte}

All end part is inside comment.

See addition in my previous post on reading the screen for text.

The main pas file was missing from my zip :(

Edited by pyTony: n/a

0

it seems that doc doesn't do what i wanted.... here's the correct one

and i cant see where the full line is destroyed and then the hole system comes down...(in your file)

Attachments
uses crt,dos;
var tip,x,y,x1,y1,x2,y2,j:byte;
    counter,i,speed,max:word;
    lovit,linie,gmax:boolean;
    z:integer;
    f:text;
    c:char;
    regs:registers ;
    cage:array[0..100,0..100] of byte;
                                                         {-->desenarea celor 7 obiecte}
procedure showtime0(j,a,b: word);
begin case j of
       0: begin gotoxy(a,b);     Write('');
                gotoxy(a,b+1);   Write('');
                gotoxy(a,b+2);   Write('');
                cage[b,a]:=1;
                cage[b+1,a]:=1;
                cage[b+2,a]:=1;                      {gotoxy(<col>,<lin>) si matrix[<lin>,<col>]}
                cage[b+2,a+1]:=1;
          end;
       1: begin b:=b+1;
                gotoxy(a,b);     Write('');
                gotoxy(a,b+1);   Write('');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b+1,a]:=1;
          end;
       2: begin gotoxy(a,b);     Write('');
                gotoxy(a+1,b+1); Write('');
                gotoxy(a+1,b+2); Write('');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b+1,a+1]:=1;
                cage[b+2,a+1]:=1;
          end;
       3: begin b:=b+2;
                gotoxy(a,b);     Write('');
                gotoxy(a+2,b-1); Write('');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b-1,a+2]:=1;
          end;
       end;
       regs.ax:=$0100;  {->stergerea cursorului}
       regs.cl:=$20;
       regs.ch:=$20;
       intr($10,regs);  {stergerea cursorului<-}
end;

procedure showtime1(j,a,b: word);
begin case j of
       0: begin gotoxy(a+1,b);     Write('');
                gotoxy(a+1,b+1);   Write('');
                gotoxy(a,b+2);     Write('');
                cage[b,a+1]:=1;
                cage[b+1,a+1]:=1;
                cage[b+2,a]:=1;
                cage[b+2,a+1]:=1;
          end;
       1: begin b:=b+1;
                gotoxy(a,b);       Write('');
                gotoxy(a,b-1);     Write('');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b-1,a]:=1;
          end;
       2: begin gotoxy(a,b);       Write('');
                gotoxy(a,b+1);     Write('');
                gotoxy(a,b+2);     Write('');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b+1,a]:=1;
                cage[b+2,a]:=1;
          end;
       3: begin b:=b+2;
                gotoxy(a,b);       Write('');
                gotoxy(a+2,b+1);   Write('');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b+1,a+2]:=1;
          end;
       end;
       regs.ax:=$0100;
       regs.cl:=$20;
       regs.ch:=$20;
       intr($10,regs);
end;

procedure showtime2(j,a,b: word);
begin case j of
       0: begin a:=a+1;
                gotoxy(a,b);     Write('');
                gotoxy(a,b+1);   Write('');
                gotoxy(a,b+2);   Write('');
                cage[b,a]:=1;
                cage[b+1,a]:=1;
                cage[b+1,a+1]:=1;
                cage[b+2,a]:=1;
          end;
       3: begin b:=b+1;
                gotoxy(a,b);       Write('');
                gotoxy(a+1,b-1);   Write('');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b-1,a+1]:=1;
          end;
       2: begin gotoxy(a+1,b);     Write('');
                gotoxy(a,b+1);     Write('');
                gotoxy(a+1,b+2);   Write('');
                cage[b,a+1]:=1;
                cage[b+1,a]:=1;
                cage[b+1,a+1]:=1;
                cage[b+2,a+1]:=1;
          end;
       1: begin b:=b+1;
                gotoxy(a,b);       Write('');
                gotoxy(a+1,b+1);   Write('');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b+1,a+1]:=1;
          end;
       end;
       regs.ax:=$0100;
       regs.cl:=$20;
       regs.ch:=$20;
       intr($10,regs);
end;

procedure showtime3(j,a,b: word);
begin case j of
       0: begin gotoxy(a,b);       Write('');
                gotoxy(a,b+1);     Write('');
                gotoxy(a,b+2);     Write('');
                gotoxy(a,b+3);     Write('');
                gotoxy(a,b+4);     Write('');
                cage[b,a]:=1;
                cage[b+1,a]:=1;
                cage[b+2,a]:=1;
                cage[b+3,a]:=1;
                cage[b+4,a]:=1;
          end;
       1: begin b:=b+2;
                gotoxy(a-2,b);     Write('');
                cage[b,a-2]:=1;
                cage[b,a-1]:=1;
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
          end;
       end;
       regs.ax:=$0100;
       regs.cl:=$20;
       regs.ch:=$20;
       intr($10,regs);
end;

procedure showtime4(a,b: word);
begin gotoxy(a,b);     Write('');
      gotoxy(a,b+1);   Write('');
      cage[b,a]:=1;
      cage[b,a+1]:=1;
      cage[b+1,a]:=1;
      cage[b+1,a+1]:=1;
      regs.ax:=$0100;
      regs.cl:=$20;
      regs.ch:=$20;
      intr($10,regs);
end;

procedure showtime5(j,a,b: word);
begin case j of
       0: begin gotoxy(a,b);       Write('');
                gotoxy(a,b+1);     Write('');
                gotoxy(a+1,b+2);   Write('');
                cage[b,a]:=1;
                cage[b+1,a]:=1;
                cage[b+1,a+1]:=1;
                cage[b+2,a+1]:=1;
          end;
       1: begin b:=b+1;
                gotoxy(a+1,b);     Write('');
                gotoxy(a,b+1);     Write('');
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b+1,a]:=1;
                cage[b+1,a+1]:=1;
          end;
      end;
       regs.ax:=$0100;
       regs.cl:=$20;
       regs.ch:=$20;
       intr($10,regs);
end;

procedure showtime6(j,a,b: word);
begin case j of
       0: begin gotoxy(a+1,b);     Write('');
                gotoxy(a,b+1);     Write('');
                gotoxy(a,b+2);     Write('');
                cage[b,a+1]:=1;
                cage[b+1,a]:=1;
                cage[b+1,a+1]:=1;
                cage[b+2,a]:=1;
          end;
       1: begin b:=b+1;
                gotoxy(a,b);       Write('');
                gotoxy(a+1,b+1);   Write('');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b+1,a+1]:=1;
                cage[b+1,a+2]:=1;
          end;
      end;
       regs.ax:=$0100;
       regs.cl:=$20;
       regs.ch:=$20;
       intr($10,regs);
end;

procedure undraw0(j,a,b: word);                        {--->stergerea celor 7 obiecte}
begin case j of
       0: begin gotoxy(a,b);           Write(' ');
                gotoxy(a,b+1);         Write(' ');
                gotoxy(a,b+2);         Write('  ');
                cage[b,a]:=0;
                cage[b+1,a]:=0;
                cage[b+2,a]:=0;                      {gotoxy(<col>,<lin>) si matrix[<lin>,<col>]}
                cage[b+2,a+1]:=0;
          end;
       1: begin b:=b+1;
                gotoxy(a,b);           Write('   ');
                gotoxy(a,b+1);         Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b,a+2]:=0;
                cage[b+1,a]:=0;
          end;
       2: begin gotoxy(a,b);           Write('  ');
                gotoxy(a+1,b+1);       Write(' ');
                gotoxy(a+1,b+2);       Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b+1,a+1]:=0;
                cage[b+2,a+1]:=0;
          end;
       3: begin b:=b+2;
                gotoxy(a,b);           Write('   ');
                gotoxy(a+2,b-1);       Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b,a+2]:=0;
                cage[b-1,a+2]:=0;
          end;
      end;
end;

procedure undraw1(j,a,b: word);
begin case j of
       0: begin gotoxy(a+1,b);         Write(' ');
                gotoxy(a+1,b+1);       Write(' ');
                gotoxy(a,b+2);         Write('  ');
                cage[b,a+1]:=0;
                cage[b+1,a+1]:=0;
                cage[b+2,a]:=0;
                cage[b+2,a+1]:=0;
          end;
       1: begin b:=b+1;
                gotoxy(a,b);           Write('   ');
                gotoxy(a,b-1);         Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b,a+2]:=0;
                cage[b-1,a]:=0;
          end;
       2: begin gotoxy(a,b);           Write('  ');
                gotoxy(a,b+1);         Write(' ');
                gotoxy(a,b+2);         Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b+1,a]:=0;
                cage[b+2,a]:=0;
          end;
       3: begin b:=b+2;
                gotoxy(a,b);           Write('   ');
                gotoxy(a+2,b+1);       Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b,a+2]:=0;
                cage[b+1,a+2]:=0;
          end;
      end;
end;

procedure undraw2(j,a,b: word);
begin case j of
       0: begin a:=a+1;
                gotoxy(a,b);         Write(' ');
                gotoxy(a,b+1);       Write('  ');
                gotoxy(a,b+2);       Write(' ');
                cage[b,a]:=0;
                cage[b+1,a]:=0;
                cage[b+1,a+1]:=0;
                cage[b+2,a]:=0;
          end;
       3: begin b:=b+1;
                gotoxy(a,b);           Write('   ');
                gotoxy(a+1,b-1);       Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b,a+2]:=0;
                cage[b-1,a+1]:=0;
          end;
       2: begin gotoxy(a+1,b);         Write(' ');
                gotoxy(a,b+1);
0

I did not implement collision or full line removal, only played little with rotation of the pieces and stopping them correctly in sides and down as box would be empty.

Logic of dropping should be simple as you have the lines above in your array cage, just copy over the removed line until hit empty line or top, only thing to check is that it could be more than one line filled at once and doing the connected book keeping for points. But also Lazarus version of Crt I think has command to delete line from window without needing to write all content again. I do not know if it is Turbo Pascal compatible. Generally there is cross platform unit called video in Lazarus, which could be used instead of CRT to give reading and writing to screen, but can not be used simultaneously with CRT.

0

that's what i tried to do at the final lines... to make permutation between the deleted line and the rest ones... execept the part with multiple full lines... and it makes a square in the left-down corner as you can see(only if the full line is at the bottom of the cage)... and i don't know how to fix it

0

The way you had swapped coordinates for cage to y,x instead of x,y made things very confusing. I also could not understand your two loops so I did this single loop from your first one for the redraw. I did not implement early finish for the drop until first empty line (looks like you are not updating the top line of cage) and I did not test the case that top line has pieces to drop, but seems to work for me with your code. I put it to draw the redrawn pieces in green so it would be more obvious which squares are repainted.

Your 'I' piece seems long and dropping faster than others and I had some problem turning the pieces near left side (at least the 'I' piece). I think it is clear, where this code should go (x2 and y2 variables also become unused, so I removed the definition in beginning). In my file the start line of this code is 977 in your code. Maybe I did some other changes to make code more understandable, so may be different in original file.

textcolor(green); {mark redrawn peaces with green}
                    if gmax then                      {permutari ale liniilor in matrice}
                    begin for i:=x1 downto 1 do
                         for j:=1 to 16 do
                         begin
                              gotoxy(j, i);
                              cage[i,j]:=cage[i-1,j];
                              if cage[i,j]=1 then write('Û')
                              else write(' ');
                         end;
                    end;
                    textcolor(4); {return the color}

Edited by pyTony: n/a

0

i was trying to fix some issues that's why i make lower the delay of the "I" shape, and i only make it drop, to make things work faster.... and it works!! you are a genuis! thank you for everywhing! now i have to make an algorithm for points and an interface of the game:D

0

It is always possible to upvote and give reputation if you like something ;)

Looks like you could benefit of how to combine draw and undraw in same procedure (of course you must also change value put to cage accordingly) from my version of code. It had little strange shape for full block as I was earlier experimenting to find character to work both in Windows and Linux. chr(219) works well in Windows, like you use, but better to use constant instead of direct literal.

0

where can i find
1. tutorials about using images or other files(i saw in one code that he was using .dat in another one .pcx)?
2. tutorials about how to make an intro to a game, program it doesnt matter(in graphics)?
3. how to combine pascal or c++ with a 3d program?

Edited by freakvista: n/a

0

May I ask why you are limiting yourself with command line programs, when Lazarus environment for example is free and you can do stuff more fancy even easier than with command line programs?

Of course Turbo Pascal 6 is also freeware now, but still...

And also Turbo Pascal 7 now, looks like

Edited by pyTony: n/a

0

I checked for nostalgy real Turbo Pascal as it is very simple to install now from net (oh, those university days 1985).

Looks the example programs like BreakOut(hopelessly too fast these days) , BGIDemo could offer good tips if you really consider it worthwhile. For me learning say Python, my main language, and PyGame would be more sensible than going very deep in Pascal in DOS environment nowadays.

Edited by pyTony: n/a

0

So I installed the Turbo Pascal 7 and applied the speed patch.

Here is as text file my code which run in it. No collisions or completed lines, down arrow works to speed things up.

Edited by pyTony: n/a

Attachments
program TsertitGame;

uses  Dos, Crt;
const
    proportion = 10;
    Width = 16;
    Height = 30;
    full = chr(219);
    waittime = 16;
    shape_count = 5;

var
    counter, i: word;
    x, y: byte;
    current_shape, c: char;
    shapes: string[shape_count];

procedure showtime(j, a, b: word; block, shape: char);
    begin
      case shape of
        'O':
        begin
          gotoxy(a, b + 1);
          Write(block, block);
          gotoxy(a, b + 2);
          Write(block, block);
        end;
        'I':
        begin
          if b < 3 then
            b := 2;
          if j mod 2 = 1 then
          begin
            if a > 1 then
              Dec(a);
            gotoxy(a, b + 2);
            Write(block, block, block, block);
          end
          else
          begin
            if a > 1 then
              Inc(a);
            b := b - 2;
            gotoxy(a, b + 1);
            Write(block);
            gotoxy(a, b + 2);
            Write(block);
            gotoxy(a, b + 3);
            Write(block);
            gotoxy(a, b + 4);
            Write(block);
          end;
        end;
        'L': case j of
            0:
            begin
              gotoxy(a, b);
              Write(block);
              gotoxy(a, b + 1);
              Write(block);
              gotoxy(a, b + 2);
              Write(block + block);
            end;
            1:
            begin
              Inc(b);
              gotoxy(a, b);
              Write(block + block);
              Write(block);
              gotoxy(a, b + 1);
              Write(block);
            end;
            2:
            begin
              gotoxy(a + 1, b + 2);
              Write(block);
              gotoxy(a, b);
              Write(block + block);
              gotoxy(a + 1, b + 1);
              Write(block);
            end;
            3:
            begin
              b := b + 2;
              gotoxy(a, b);
              Write(block + block + block);
              gotoxy(a + 2, b - 1);
              Write(block);
            end;
          end;
        'J': case j of
            0:
            begin
              Inc(a);
              gotoxy(a, b);
              Write(block);
              gotoxy(a, b + 1);
              Write(block);
              gotoxy(a - 1, b + 2);
              Write(block + block);
            end;
            1:
            begin
              Inc(b);
              gotoxy(a, b + 1);
              Write(block + block + block);
              gotoxy(a, b);
              Write(block);
            end;
            2:
            begin
              Inc(a);
              gotoxy(a - 1, b);
              Write(block + block);
              gotoxy(a - 1, b + 1);
              Write(block);
              gotoxy(a - 1, b + 2);
              Write(block);
            end;
            3:
            begin
              b := b + 1;
              gotoxy(a, b);
              Write(block + block + block);
              gotoxy(a + 2, b + 1);
              Write(block);
            end;
          end;
        'T': case j of
            0:
            begin
              gotoxy(a, b);
              Write(block);
              gotoxy(a, b + 1);
              Write(block + block);
              gotoxy(a, b + 2);
              Write(block);
            end;
            1:
            begin
              Inc(b);
              gotoxy(a, b);
              Write(block + block + block);
              gotoxy(a + 1, b + 1);
              Write(block);
            end;
            2:
            begin
              gotoxy(a + 1, b);
              Write(block);
              gotoxy(a, b + 1);
              Write(block + block);
              gotoxy(a + 1, b + 2);
              Write(block);
            end;
            3:
            begin
              Inc(b);
              Inc(b);
              gotoxy(a, b);
              Write(block + block + block);
              gotoxy(a + 1, b - 1);
              Write(block);
            end;
          end;
      end;
      gotoxy(1, 1);
      Write(shape, j, ': ', a, ',', b, '          ');
    end;

procedure undraw(j, a, b: word; shape: char);
    begin
      showtime(j, a, b, ' ', shape);
    end;

procedure draw(j, a, b: word; shape: char);
    begin
      showtime(j, a, b, full, shape);
    end;


{$R *.res}

begin

    shapes := 'OLTIJ';
    TextBackground(brown);
    clrscr;
    window(5, 5, 5 + Width + 2, 5 + Height);
    (* make last line stay background color for scroll protection *)
    TextBackground(LightGray);
    clrscr;
    Randomize;
    (* expand one line to prevent scrolling in end *)
    window(5, 5, 5 + Width + 2, 5 + Height + 1);
    repeat
      i := random(16);
      if (i = brown) or (i = LightGray) then
        Dec(i);
      textcolor(i);
      i := Random(shape_count) + 1;
      current_shape := shapes[i];
      if current_shape = 'O' then
        i := 0
      else
        i := Random(4);

      x := 13;
      y := 1;
      counter := 0;
      draw(i, x, y, current_shape);

      repeat
        delay(waittime);
        Inc(counter);
        if counter mod proportion = 0 then
        begin
          undraw(i, x, y, current_shape);
          if y <= Height - 2 then
            Inc(y);
        end;
        while keypressed do
        begin
          c := readkey;
          undraw(i, x, y, current_shape);
          if c = #0 then
          begin
            c := readkey;
            undraw(i, x, y, current_shape);
            case c of
              #72: if current_shape <> 'O' then
                begin
                  if x > Width then
                  begin
                    Dec(x);
                  end;
                  i := (i + 1) mod 4;
                end;
              #77: if (x <= Width) or (((i = 0) or (i = 2)) and (x = Width + 1)) then
                  Inc(x);
              #75: if (x > 1) then
                  Dec(x);
              else
                if y <= Height - 2 then
                  Inc(y);
            end;
          end;
        end;
        draw(i, x, y, current_shape);
      until (c = 'q') or ((y > Height - 2) and (counter mod proportion = 0));
    until (c = 'q');
end.
0

i tried to make the game with graph so that i can make two or three cages, and to make a game interface, but now i have a problem... i dont know how to stop the graph..i made a game interface and then i made two cages... and now i don't want to use graph anymore.... i tried with closegraph, cleardevice... but it didnt word... i tried to make the whole game with graph but i dont know how to delete a '*' because it's not working with outtext(' ');....

0

you mean PutImage(ulx, uly, Saucer^, XORput); { erase image } ?

or

for I := 1 to 2 do { erase image }
PutImage(Pos.XOld, Pos.YOld, Saucer^, XORput);

i don'y know what are and how to use pointers.... and i dont know how to use putimage and getimage... so here's the code

Attachments
UNIT Show_Bmp;

INTERFACE

USES Crt;

CONST
     VGA = $A000;

TYPE
    BMPHeaderRec = record
         Identifier     : Array[0..1] Of Char;
         Size           : LongInt;
         Reserved       : LongInt;
         BitMapOffset   : LongInt;
         CheckType      : LongInt;
         Width          : LongInt;
         Height         : LongInt;
         Planes         : Word;
         Bits           : Word;
         Compression    : LongInt;
         ImageSize      : LongInt;
         XPels          : LongInt;
         YPels          : LongInt;
         ColorUsed      : LongInt;
         ColorImportant : LongInt;
    End;

    InfoBlock = record
      Valid     : Boolean;
      Cmp       : ShortInt;
      BMPHeader   : BMPHeaderRec;
    END;

    ColorType = record
      Blue    : Byte;
      Green   : Byte;
      Red     : Byte;
      Index   : Integer;
    END;

    HiColorType = record
      Blue    : Byte;
      Green   : Byte;
      Red     : Byte;
    END;

VAR
   ScreenH              : Integer;
   ScreenW              : Integer;
   BPP                  : Byte;

PROCEDURE Graphix(Mode : Word);
PROCEDURE SetTextMode;
PROCEDURE SetPal(Num : Byte;Red, Green, Blue : Byte);
PROCEDURE GetPal(Num : Byte;VAR Red, Green, Blue : Byte);
PROCEDURE GetPixel(X,Y : Integer;VAR Color : ColorType);
PROCEDURE PutPixel(X,Y : Integer;Color, ClearColor : ColorType; Where : Word);
FUNCTION  GetBMPInfo(Name : String; VAR Info : InfoBlock) : Boolean;
PROCEDURE ShowBMPInfo(Info : InfoBlock);
FUNCTION  ShowBMP(StartX, StartY : Integer; Name : String; DoColors : Boolean; Clear : ColorType; Where : Word) : Boolean;

IMPLEMENTATION

CONST
     Header : array[1..2] Of Char = 'BM';
     PalCount    = 255;
     BI_RGB      = 0;
     BI_RLE8     = 1;
     BI_RLE4     = 2;

VAR
   Colors               : Array[0..255,1..4] Of Byte;
   C                    : Char;
   CA                   : Array[0..7] Of Boolean;
   CA2                  : Array[1..3] Of Byte;
   CurrentMode          : Word;
   CurrentBlock         : Byte;
   Red, Blue, Green     : Byte;
   Temp                 : Byte;
   Temp2                : Array[1..4] Of Byte;
   F                    : File;
   S2                   : Array[1..2] Of Char;
   Junk                 : Array[0..10000] Of Char;
   X, X2, Y, Y2, Z          : Integer;

PROCEDURE Graphix(Mode : Word);
Begin
     ASM
        Cmp Mode, $FF
        Jg @VESA
        Mov Ax, Mode
        INT 10h
        Mov ScreenW, 320
        Mov ScreenH, 200
        Mov BPP, 8
       @MT1:
        Cmp Mode, $11
        Jne @MT2
        Mov ScreenW, 640
        Mov ScreenH, 480
        Mov BPP, 1
       @MT2:
        Cmp Mode, $12
        Jne @MT3
        Mov ScreenW, 640
        Mov ScreenH, 480
        Mov BPP, 4
       @MT3:
        Cmp Mode, $13
        Jne @MT4
        Mov ScreenW, 320
        Mov ScreenH, 200
        Mov BPP, 8
       @MT4:
        Jmp @End
       @VESA:
        Mov Ax, $4F02
        Mov Bx, Mode
        INT 10h
       @VMT01:
        Cmp Mode, $101
        Jne @VMT0F
        Mov ScreenW, 640
        Mov ScreenH, 480
        Mov BPP, 8
       @VMT0F:
        Cmp Mode, $10F
        Jne @VMT10
        Mov ScreenW, 320
        Mov ScreenH, 200
        Mov BPP, 32
       @VMT10:
        Cmp Mode, $110
        Jne @VMT11
        Mov ScreenW, 640
        Mov ScreenH, 480
        Mov BPP, 16
       @VMT11:
        Cmp Mode, $111
        Jne @VMT12
        Mov ScreenW, 640
        Mov ScreenH, 480
        Mov BPP, 16
       @VMT12:
        Cmp Mode, $112
        Jne @VMT15
        Mov ScreenW, 640
        Mov ScreenH, 480
        Mov BPP, 32
       @VMT15:
        Cmp Mode, $115
        Jne @VMT5
        Mov ScreenW, 800
        Mov ScreenH, 600
        Mov BPP, 32
       @VMT5:
       @End:
     End;
     CurrentMode := Mode;
End;

PROCEDURE SetTextMode; assembler;
ASM
   Mov Ax, $0003
   INT 10h
   Mov ScreenW, 80
   Mov ScreenH, 25
End;

PROCEDURE SetPal(Num : Byte;Red, Green, Blue : Byte);
Begin
     Port[$3c8] := Num;
     Port[$3c9] := Red;
     Port[$3c9] := Green;
     Port[$3c9] := Blue;
End;

PROCEDURE GetPal(Num : Byte;VAR Red, Green, Blue : Byte);
Begin
     Port[$3c7] := Num;
     Red   := Port[$3c9];
     Green := Port[$3c9];
     Blue  := Port[$3c9];
End;

PROCEDURE SetBlock(X,Y : Integer);
Begin
     Temp := (((LONGINT(Y)*ScreenW*(BPP Shr 3)+X)) Shr 16);
     If CurrentBlock <> Temp Then
     Begin
          ASM
             Mov Ax, $4f05
             Xor Bh, Bh
             Mov Dl, Temp
             Int $10
          END;
          CurrentBlock := Temp;
     End;
End;

PROCEDURE GetPixel(X,Y : Integer;VAR Color : ColorType);
Begin
     If (X < 0) or (Y < 0) or (X >= ScreenW) or (Y >= ScreenH) Then Exit;
     With Color Do
     Begin
       If BPP <= 8 Then
       Begin
         SetBlock(X*(BPP Shr 3),Y);
         Index := Mem[$A000:((X+Y*ScreenW)*(BPP Shr 3)) - Temp Shl 16]
       End
       ELSE
       Begin
         SetBlock(X*(BPP Shr 3),Y);
         Blue  := Mem[$A000:((X+Y*ScreenW)*(BPP Shr 3)+0) - Temp Shl 16];
         SetBlock(X*(BPP Shr 3)+1,Y);
         Green := Mem[$A000:((X+Y*ScreenW)*(BPP Shr 3)+1) - Temp Shl 16];
         SetBlock(X*(BPP Shr 3)+2,Y);
         Red   := Mem[$A000:((X+Y*ScreenW)*(BPP Shr 3)+2) - Temp Shl 16];
         Index := -1;
       End;
     End;
End;

PROCEDURE PutPixel(X,Y : Integer;Color, ClearColor : ColorType; Where : Word);
VAR Z : Byte;
Begin
     If (X < 0) or (Y < 0) or (X >= ScreenW) or (Y >= ScreenH) Then Exit;
     With Color Do
     Begin
       If BPP <= 8 Then
       Begin
         If Color.Index = ClearColor.Index Then Exit;
         Z := BPP Shr 3;
         SetBlock(X*Integer(Z),Y);
         Mem[Where:((X+Y*ScreenW)*Integer(Z)) - (CurrentBlock Shl 16)] := Index;
       End
       ELSE
       If (Color.Red   = ClearColor.Red) AND
          (Color.Green = ClearColor.Green) AND
          (Color.Blue  = ClearColor.Blue) Then Exit
       ELSE
       If Index = -1 Then
       Begin
            Case BPP Of
             16 : Begin
                       SetBlock(X*2,Y);
                       Mem[Where:((X+Y*ScreenW)*2+0) - CurrentBlock Shl 16] :=
                           (Blue Shr 3) AND 31 + ((Green Shr 3) Shl 7) AND 224;
                       SetBlock(X*2+1,Y);
                       Mem[Where:((X+Y*ScreenW)*2+1) - CurrentBlock Shl 16] :=
                           (((Green Shr 3) Shr 2) AND 7) + (((RED Shr 3) Shl 3) AND 248);
                  End;
             24,
             32 : Begin
                       SetBlock(X*(BPP Shr 3)+0,Y);
                       Mem[Where:((X+Y*ScreenW)*(BPP Shr 3)+0) - CurrentBlock Shl 16] := Blue;
                       SetBlock(X*(BPP Shr 3)+1,Y);
                       Mem[Where:((X+Y*ScreenW)*(BPP Shr 3)+1) - CurrentBlock Shl 16] := Green;
                       SetBlock(X*(BPP Shr 3)+2,Y);
                       Mem[Where:((X+Y*ScreenW)*(BPP Shr 3)+2) - CurrentBlock Shl 16] := Red;
                  End;
            End;
       End
       ELSE
       Begin
         Color.Blue  := Colors[Index,1];
         Color.Green := Colors[Index,2];
         Color.Red   := Colors[Index,3];
         SetBlock(X*(BPP Shr 3),Y);
         Mem[Where:((X+Y*ScreenW)*(BPP Shr 3)+0) - CurrentBlock Shl 16] := Blue;
         SetBlock(X*(BPP Shr 3)+1,Y);
         Mem[Where:((X+Y*ScreenW)*(BPP Shr 3)+1) - CurrentBlock Shl 16] := Green;
         SetBlock(X*(BPP Shr 3)+2,Y);
         Mem[Where:((X+Y*ScreenW)*(BPP Shr 3)+2) - CurrentBlock Shl 16] := Red;
       End;
     End;
End;

FUNCTION GetBMPInfo(Name : String; VAR Info : InfoBlock) : Boolean;
VAR Final : Boolean;
Begin
     GetBMPInfo := False;
     Assign(F, Name);{$I-}Reset(F,1);{$I+}
     If IOResult <> 0 Then Exit;
     BlockRead(F, Info.BMPHeader, SizeOf(Info.BMPHeader));

     Info.Valid := Info.BMPHeader.Identifier = Header;
     Final := Info.Valid;

     Info.Cmp := Info.BMPHeader.Compression;
     If Info.Cmp In[0] Then Final := True;

     Close(F);
     GetBMPInfo := True;
End;

PROCEDURE ShowBMPInfo(Info : InfoBlock);
Begin
     With Info.BMPHeader Do
     Begin
          GotoXY(21, 1);WriteLn('Size        = ',Size);
          GotoXY(21, 2);WriteLn('BitMapOffset= ',BitMapOffset);
          GotoXY(21, 3);WriteLn('Type        = ',CheckType);
          GotoXY(21, 4);WriteLn('Width       = ',Width);
          GotoXY(21, 5);WriteLn('Height      = ',Height);
          GotoXY(21, 6);WriteLn('Bits        = ',ORD(Bits));
          GotoXY(21, 7);WriteLn('Planes      = ',ORD(Planes));
          GotoXY(21, 8);WriteLn('FileSize    = ',ImageSize);
          GotoXY(21, 9);WriteLn('RealSize    = ',Width*Height);
          GotoXY(21,10);WriteLn('XPelsPerMet = ',XPels);
          GotoXY(21,11);WriteLn('YPelsPerMet = ',YPels);
          GotoXY(21,12);WriteLn('Color Used  = ',ColorUsed);
          GotoXY(21,13);WriteLn('Color Imp.  = ',ColorImportant);
     End;
End;

FUNCTION ShowBMP(StartX, StartY : Integer; Name : String; DoColors : Boolean; Clear : ColorType; Where : Word) : Boolean;
VAR
   Info : InfoBlock;
   Color : ColorType;
Begin
     If GetBMPInfo(Name,Info) = False Then
     Begin
          ShowBMP := False;
          Exit;
     End
     ELSE ShowBMP := True;
     Assign(F, Name);Reset(F,1);
     BlockRead(F, Info.BMPHeader, SizeOf(Info.BMPHeader));

     Reset(F,1);
     BlockRead(F, Junk, 14);
     BlockRead(F, Junk, Info.BMPHeader.CheckType);
     With Info.BMPHeader Do
     If Bits = 1 Then
     Begin
        For X := 0 to 1 Do
            Begin
                 BlockRead(F, Colors[X], 4);
                 SetPal(X*63, Colors[X,3]*63 DIV 255, Colors[X,2]*63 DIV 255, Colors[X,1]*63 DIV 255);
            End;
        Reset(F,1);
        BlockRead(F, Junk, BitMapOffset);
        Z := Width SHR 3;
          While Z MOD(4) <> 0 Do Inc(Z);
        For Y := 0 to Height-1 Do
            Begin
                 BlockRead(F, Junk, Z);
                 For X := 0 to Z-1 Do
uses crt,dos,graph,show_bmp;
var tip,x,y,x1,y1,x2,y2,j,sageata:byte;
    counter,i,speed,max,score,aux:word;
    lovit,linie,gmax:boolean;
    z:integer;
    c:char;
    regs:registers ;
    cage:array[0..100,0..100] of byte;

                                                        {-->desenarea celor 7 obiecte}
procedure showtime0(j,a,b: word);
begin case j of
       0: begin gotoxy(a,b);     Write('*');
                gotoxy(a,b+1);   Write('*');
                gotoxy(a,b+2);   Write('**');
                cage[b,a]:=1;
                cage[b+1,a]:=1;
                cage[b+2,a]:=1;                      {gotoxy(<col>,<lin>) si matrix[<lin>,<col>]}
                cage[b+2,a+1]:=1;
          end;
       1: begin b:=b+1;
                gotoxy(a,b);     Write('***');
                gotoxy(a,b+1);   Write('*');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b+1,a]:=1;
          end;
       2: begin gotoxy(a,b);     Write('**');
                gotoxy(a+1,b+1); Write('*');
                gotoxy(a+1,b+2); Write('*');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b+1,a+1]:=1;
                cage[b+2,a+1]:=1;
          end;
       3: begin b:=b+2;
                gotoxy(a,b);     Write('***');
                gotoxy(a+2,b-1); Write('*');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b-1,a+2]:=1;
          end;
       end;
       regs.ax:=$0100;  {->stergerea cursorului}
       regs.cl:=$20;
       regs.ch:=$20;
       intr($10,regs);  {stergerea cursorului<-}
end;

procedure showtime1(j,a,b: word);
begin case j of
       0: begin gotoxy(a+1,b);     Write('*');
                gotoxy(a+1,b+1);   Write('*');
                gotoxy(a,b+2);     Write('**');
                cage[b,a+1]:=1;
                cage[b+1,a+1]:=1;
                cage[b+2,a]:=1;
                cage[b+2,a+1]:=1;
          end;
       1: begin b:=b+1;
                gotoxy(a,b);       Write('***');
                gotoxy(a,b-1);     Write('*');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b-1,a]:=1;
          end;
       2: begin gotoxy(a,b);       Write('**');
                gotoxy(a,b+1);     Write('*');
                gotoxy(a,b+2);     Write('*');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b+1,a]:=1;
                cage[b+2,a]:=1;
          end;
       3: begin b:=b+2;
                gotoxy(a,b);       Write('***');
                gotoxy(a+2,b+1);   Write('*');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b+1,a+2]:=1;
          end;
       end;
       regs.ax:=$0100;
       regs.cl:=$20;
       regs.ch:=$20;
       intr($10,regs);
end;

procedure showtime2(j,a,b: word);
begin case j of
       0: begin a:=a+1;
                gotoxy(a,b);     Write('*');
                gotoxy(a,b+1);   Write('**');
                gotoxy(a,b+2);   Write('*');
                cage[b,a]:=1;
                cage[b+1,a]:=1;
                cage[b+1,a+1]:=1;
                cage[b+2,a]:=1;
          end;
       3: begin b:=b+1;
                gotoxy(a,b);       Write('***');
                gotoxy(a+1,b-1);   Write('*');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b-1,a+1]:=1;
          end;
       2: begin gotoxy(a+1,b);     Write('*');
                gotoxy(a,b+1);     Write('**');
                gotoxy(a+1,b+2);   Write('*');
                cage[b,a+1]:=1;
                cage[b+1,a]:=1;
                cage[b+1,a+1]:=1;
                cage[b+2,a+1]:=1;
          end;
       1: begin b:=b+1;
                gotoxy(a,b);       Write('***');
                gotoxy(a+1,b+1);   Write('*');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b+1,a+1]:=1;
          end;
       end;
       regs.ax:=$0100;
       regs.cl:=$20;
       regs.ch:=$20;
       intr($10,regs);
end;

procedure showtime3(j,a,b: word);
begin case j of
       0: begin gotoxy(a,b);       Write('*');
                gotoxy(a,b+1);     Write('*');
                gotoxy(a,b+2);     Write('*');
                gotoxy(a,b+3);     Write('*');
                gotoxy(a,b+4);     Write('*');
                cage[b,a]:=1;
                cage[b+1,a]:=1;
                cage[b+2,a]:=1;
                cage[b+3,a]:=1;
                cage[b+4,a]:=1;
          end;
       1: begin b:=b+2;
                gotoxy(a-2,b);     Write('*****');
                cage[b,a-2]:=1;
                cage[b,a-1]:=1;
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
          end;
       end;
       regs.ax:=$0100;
       regs.cl:=$20;
       regs.ch:=$20;
       intr($10,regs);
end;

procedure showtime4(a,b: word);
begin gotoxy(a,b);     Write('**');
      gotoxy(a,b+1);   Write('**');
      cage[b,a]:=1;
      cage[b,a+1]:=1;
      cage[b+1,a]:=1;
      cage[b+1,a+1]:=1;
      regs.ax:=$0100;
      regs.cl:=$20;
      regs.ch:=$20;
      intr($10,regs);
end;

procedure showtime5(j,a,b: word);
begin case j of
       0: begin gotoxy(a,b);       Write('*');
                gotoxy(a,b+1);     Write('**');
                gotoxy(a+1,b+2);   Write('*');
                cage[b,a]:=1;
                cage[b+1,a]:=1;
                cage[b+1,a+1]:=1;
                cage[b+2,a+1]:=1;
          end;
       1: begin b:=b+1;
                gotoxy(a+1,b);     Write('**');
                gotoxy(a,b+1);     Write('**');
                cage[b,a+1]:=1;
                cage[b,a+2]:=1;
                cage[b+1,a]:=1;
                cage[b+1,a+1]:=1;
          end;
      end;
       regs.ax:=$0100;
       regs.cl:=$20;
       regs.ch:=$20;
       intr($10,regs);
end;

procedure showtime6(j,a,b: word);
begin case j of
       0: begin gotoxy(a+1,b);     Write('*');
                gotoxy(a,b+1);     Write('**');
                gotoxy(a,b+2);     Write('*');
                cage[b,a+1]:=1;
                cage[b+1,a]:=1;
                cage[b+1,a+1]:=1;
                cage[b+2,a]:=1;
          end;
       1: begin b:=b+1;
                gotoxy(a,b);       Write('**');
                gotoxy(a+1,b+1);   Write('**');
                cage[b,a]:=1;
                cage[b,a+1]:=1;
                cage[b+1,a+1]:=1;
                cage[b+1,a+2]:=1;
          end;
      end;
       regs.ax:=$0100;
       regs.cl:=$20;
       regs.ch:=$20;
       intr($10,regs);
end;

procedure undraw0(j,a,b: word);                        {--->stergerea celor 7 obiecte}
begin case j of
       0: begin gotoxy(a,b);           Write(' ');
                gotoxy(a,b+1);         Write(' ');
                gotoxy(a,b+2);         Write('  ');
                cage[b,a]:=0;
                cage[b+1,a]:=0;
                cage[b+2,a]:=0;                      {gotoxy(<col>,<lin>) si matrix[<lin>,<col>]}
                cage[b+2,a+1]:=0;
          end;
       1: begin b:=b+1;
                gotoxy(a,b);           Write('   ');
                gotoxy(a,b+1);         Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b,a+2]:=0;
                cage[b+1,a]:=0;
          end;
       2: begin gotoxy(a,b);           Write('  ');
                gotoxy(a+1,b+1);       Write(' ');
                gotoxy(a+1,b+2);       Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b+1,a+1]:=0;
                cage[b+2,a+1]:=0;
          end;
       3: begin b:=b+2;
                gotoxy(a,b);           Write('   ');
                gotoxy(a+2,b-1);       Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b,a+2]:=0;
                cage[b-1,a+2]:=0;
          end;
      end;
end;

procedure undraw1(j,a,b: word);
begin case j of
       0: begin gotoxy(a+1,b);         Write(' ');
                gotoxy(a+1,b+1);       Write(' ');
                gotoxy(a,b+2);         Write('  ');
                cage[b,a+1]:=0;
                cage[b+1,a+1]:=0;
                cage[b+2,a]:=0;
                cage[b+2,a+1]:=0;
          end;
       1: begin b:=b+1;
                gotoxy(a,b);           Write('   ');
                gotoxy(a,b-1);         Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b,a+2]:=0;
                cage[b-1,a]:=0;
          end;
       2: begin gotoxy(a,b);           Write('  ');
                gotoxy(a,b+1);         Write(' ');
                gotoxy(a,b+2);         Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b+1,a]:=0;
                cage[b+2,a]:=0;
          end;
       3: begin b:=b+2;
                gotoxy(a,b);           Write('   ');
                gotoxy(a+2,b+1);       Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b,a+2]:=0;
                cage[b+1,a+2]:=0;
          end;
      end;
end;

procedure undraw2(j,a,b: word);
begin case j of
       0: begin a:=a+1;
                gotoxy(a,b);         Write(' ');
                gotoxy(a,b+1);       Write('  ');
                gotoxy(a,b+2);       Write(' ');
                cage[b,a]:=0;
                cage[b+1,a]:=0;
                cage[b+1,a+1]:=0;
                cage[b+2,a]:=0;
          end;
       3: begin b:=b+1;
                gotoxy(a,b);           Write('   ');
                gotoxy(a+1,b-1);       Write(' ');
                cage[b,a]:=0;
                cage[b,a+1]:=0;
                cage[b,a+2]:=0;
                cage[b-1,a+1]:=0;
          end;
       2: begin gotoxy(a+1,b);         Write(' ');
0

i made the game without the gameinterface, and i want to know.... how can i put sounds in background?(i know how to make sounds, but its hard to synchronize and i don't have any ideas about how to put sounds in background)
and if it's another way to make sounds... i mean the sound() procedure makes sounds from the pc and i want to make or put my own songs.. if you understand..

0

i dont know how to use it, and i dont know how to make or open .muz files

0

i found in one syte how to make back sound, but i downloaded from there .ppu and .o files, they say that they are units, but when im runing the program it sais that i can't fint .tpu....

0

i think i figured out what it's happening... my pascal has the height and width modified so that when i tried to run my game on other pascal it didn't look like on my pascal... so here's what i'm thinking...
When i use graph the program modifies some of the pascal properties and it cannot be reversed until you exit the program and start it again... so if i can find out how to make these modifies manualy i think that the problem will be solved...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.