home *** CD-ROM | disk | FTP | other *** search
- {$G+}
- { this is an example for use the sprites in a programa }
- { by Enrique Sanchez Martinez 1995 }
- program juego;
-
- uses svga,crt,dos,graph;
-
-
-
- var
-
- f:file;
- x,y,size,I,result:word;
- sprite,fondo:pointer;
- nombrespr:string;
- REG:REGISTERS;
- PALL:ARRAY[0..767]OF BYTE;
-
-
-
-
-
- procedure leerspr(nombrespr:string);
- begin
- IF POS('.',nombrespr)<1 THEN
- nombrespr:=nombrespr+'.SPR';
- {$I-}
- assign(F,nombrespr);
- reset(f,1);
- RESULT:=IORESULT;
- if RESULT <> 0 then
- begin
- Writeln(' ■ File '+nombrespr+' not found ');
- halt(1);
- end;
- {$I+}
- SIZE:=FILESIZE(F);
- GETMEM(SPRITE,SIZE);
- BLOCKREAD(F,SPRITE^,SIZE,SIZE);
- close(f);
- end;
-
-
-
- procedure leerpall(nombrepal:string);
- begin
- IF POS('.',nombrepal)<1 THEN
- nombrepal:=nombrepal+'.PAL';
- {$I-}
- assign(F,nombrepal);
- reset(f,1);
- RESULT:=IORESULT;
- if RESULT <> 0 then
- begin
- Writeln(' ■ File '+nombrepal+' not found ');
- halt(1);
- end;
- {$I+}
- SIZE:=768;
- BLOCKREAD(F,pall,SIZE,SIZE);
- close(f);
- end;
-
-
- procedure ponpall;
- begin
- REG.AX:=$1012;
- REG.BX:=$00;
- REG.CX:=$100;
- REG.ES:=SEG(PALL);
- REG.DX:=OFS(PALL);
- INTR($10,REG);
- end;
-
-
-
- begin
- leerspr('p1');
- GETMEM(fondo,2600);
- leerpall('pal1');
- inicia(0);
-
-
- ponpall;
- putimage(0,0,sprite^,normalput);
- leerspr('balaex');
- x:=10;
- y:=20;
- getimage(x,y,x+50,y+16,fondo^);
- putimage(x,y,sprite^,trans_copy_put);
- for x := 10 to 300 do
- begin
- putimage(x,y,fondo^,normalput);
- getimage(x+1,y,x+51,y+16,fondo^);
- putimage(x+1,y,sprite^,trans_copy_put);
-
- DELAY(20);
- end;
-
- leerspr('balaex');
- for x := 10 to 300 do
- begin
- putimage(x,y,sprite^,trans_copy_put);
- end;
-
- leerspr('bala');
- cleardevice;
- for i:=1 to 5 do
- begin
- for x := 10 to 300 do
- begin
- putimage(x,y,sprite^,normalput);
- end;
- end;
-
- closegraph;
- end.