Como fazer O Jogo Snake no Pascalzim! program snake; uses - TopicsExpress



          

Como fazer O Jogo Snake no Pascalzim! program snake; uses crt,graph; const passo=19; var coor:array[1..800,1..2]of integer; n:array[1..9]of char; cont,driver,mode,i,j,x,y,xc,yc,totale,ultx,ulty,punteggio,primato,vel:integer; a,direzione,risp,tasto:char; oldscore,score,s:string; occupato,infrociamento,mangia:boolean; procedure logo; begin detectgraph(driver,mode);initgraph(driver,mode,c:\tp\bgi); rectangle(0,0,639,479); settextstyle(0,0,11); outtextxy(100,3,Snake); settextstyle(0,0,0); outtextxy(300,100,v1.0); outtextxy(275,115,programming:); rectangle(190,180,430,340); bar(212,202,312,214);bar(212,202,224,272);bar(300,202,312,240); bar(300,228,360,240); circle(218,300,5); outtextxy(300,370,Keys:); outtextxy(280,390,Numpad 8-up); outtextxy(280,400,Numpad 2-down); outtextxy(280,410,Numpad 4-left); outtextxy(280,420,Numpad 6-right); outtextxy(290,465,Hit Enter); (**) n[1]:=N; n[2]:=e; n[3]:=r; n[4]:=k; n[5]:=i; n[6]:=a; n[7]:=t; n[8]:=o; n[9]:=r; s:=Nerkiator; repeat if not keypressed then for i:=1 to 9 do begin for x:=637 downto 265+i*8 do begin if not keypressed then outtextxy(x,140,n[i]);delay(4);setcolor(black);outtextxy(x,140,n[i]); setcolor(red) end; if not keypressed then outtextxy(265+i*8,140,n[i]) end; if not keypressed then delay(1500); if not keypressed then for j:=273 downto 2 do begin if not keypressed then outtextxy(j,140,s);setcolor(black);outtextxy(j,140,s);setcolor(red) end until keypressed; (**) setcolor(white); end; procedure campo; begin rectangle(8,8,(passo*30)-8,(passo*24)-8); outtextxy(580,80,Score:) end; procedure segmento(x,y:integer); begin setcolor(black); rectangle(x-9,y-9,x+9,y+9); setfillstyle(12,white); bar(x-8,y-8,x+8,y+8); setcolor(white) end; procedure cancsegm(x,y:integer); begin setfillstyle(1,black); bar(x-9,y-9,x+9,y+9); setfillstyle(1,white) end; procedure cibo(x,y:integer); begin x:=x*passo; y:=y*passo; circle(x,y,9) end; procedure suono; var i:integer; begin for i:=1 to 30000 do sound(100); nosound end; procedure gnam; var i:integer; begin for i:=1 to 5000 do sound(1100); nosound end; function punti(x:integer):string; var s:string[10]; begin str(x,s); punti:=s; end; procedure gioco; begin cleardevice; campo; punteggio:=0; oldscore:=punti(punteggio); score:=oldscore; x:=passo*15;y:=passo*23; direzione:=6; tasto:=6; totale:=8; infrociamento:=false; mangia:=false; coor[1,1]:=x;coor[1,2]:=y; occupato:=false; for i:=2 to totale do begin coor[i,1]:=coor[i-1,1]-passo;coor[i,2]:=y end; xc:=15;yc:=12; cibo(xc,yc); repeat setcolor(black); outtextxy(580,100,oldscore); setcolor(white); outtextxy(580,100,score); for i:=1 to totale do segmento(coor[i,1],coor[i,2]); delay(270); cancsegm(coor[totale,1],coor[totale,2]); delay(270); if (x=xc*passo) and (y=yc*passo) then mangia:=true; if mangia then begin punteggio:=punteggio+9; score:=punti(punteggio); oldscore:=punti(punteggio-9); totale:=totale+1; coor[totale,1]:=ultx;coor[totale,2]:=ulty; gnam; repeat occupato:=false; xc:=random(29)+1;yc:=random(23)+1; for i:=1 to totale do if(coor[i,1]=xc*passo)and(coor[i,2]=yc*passo)then occupato:=true until not occupato; cibo(xc,yc); mangia:=false end; if keypressed then tasto:=readkey; case tasto of 8:if direzione5 then direzione:=8; 2:if direzione8 then direzione:=5; 6:if direzione4 then direzione:=6; 4:if direzione6 then direzione:=4 end; case direzione of 8: y:=y-passo; 5: y:=y+passo; 6: x:=x+passo; 4: x:=x-passo end; ultx:=coor[totale,1];ulty:=coor[totale,2]; for i:=totale downto 2 do begin coor[i,1]:=coor[i-1,1]; coor[i,2]:=coor[i-1,2] end; coor[1,1]:=x;coor[1,2]:=y; for i:=2 to totale do begin if (coor[i,1]=x) and (coor[i,2]=y) then infrociamento:=true end until (x-passo
Posted on: Sat, 22 Mar 2014 12:33:06 +0000

Trending Topics



:30px;">
FERWHITE PURE L - GLUTATHIONE COLLAGEN 500000MG. FERWHITE PURE L
A touching love story that ll make u cry 10th Grade:- As I sat
sttext" style="margin-left:0px; min-height:30px;"> My daughter Lauren loves animals and nurtures them. A recent
Yung Klitzner

Recently Viewed Topics




© 2015