为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

Free Pascal 射击游戏

2017-11-15 8页 doc 20KB 41阅读

用户头像

is_421808

暂无简介

举报
Free Pascal 射击游戏Free Pascal 射击游戏 Program shooting_game; uses crt; const cz:array[1..4,1..2] of -1..1=((0,1),(1,0),(0,-1),(-1,0)); var i,j,xz1,yz1,y1,xz2,yz2,y2,t1,t2,t3,k,v1,v2:integer; ch:char; a:array[1..20] of integer; procedure priter; begin gotoxy(1,1); textbackground...
Free Pascal 射击游戏
Free Pascal 射击游戏 Program shooting_game; uses crt; const cz:array[1..4,1..2] of -1..1=((0,1),(1,0),(0,-1),(-1,0)); var i,j,xz1,yz1,y1,xz2,yz2,y2,t1,t2,t3,k,v1,v2:integer; ch:char; a:array[1..20] of integer; procedure priter; begin gotoxy(1,1); textbackground(green); for i:=1 to 20 do begin for j:=1 to 40 do write(' '); writeln; end; end; procedure priv; begin gotoxy(1,1); write('v1:',v1:3,' v2:',v2:2); end; procedure start; begin priter; textcolor(black); textbackground(green); gotoxy(1,1); write('Really? '); ch:=readkey; for i:=3 downto 1 do begin write(i); sound(1871); delay(500); nosound; delay(500); write(#8); end; write('Go!!!'); sound(2500); delay(500); nosound; end; procedure GameOver(p:integer); begin if p=1 then begin gotoxy(1,y1);write(']*');end; if p=2 then begin gotoxy(39,y2);write('*[');end; textcolor(green); textbackground(black); gotoxy(10,10); p:=3-p; write('Player ',p:1,' is Win!!!'); repeat ch:=readkey;until ord(ch)=13; textbackground(black); ClrScr; halt; end; procedure over(p:integer); begin if p=1 then begin dec(v1);gotoxy(1,y1);write(']*');end; if p=2 then begin dec(v2);gotoxy(39,y2);write('*[');end; priv; if v1=0 then gameover(1); if v2=0 then gameover(2); end; procedure go; begin textbackground(black); ClrScr; for i:=1 to 20 do a[i]:=38; textbackground(green); textcolor(black); priter; gotoxy(1,2); y1:=1; write(']>'); gotoxy(39,2); write('<['); gotoxy(1,1); y1:=2;t1:=0;t2:=0;t3:=0;y2:=2;v1:=10;v2:=10; priv; while true do begin delay(1); inc(t1,1); if t1=1000 then begin inc(t2); if t2=60 then begin t2:=0;inc(t3);end; end; if keypressed then begin ch:=readkey; if (ch='i') and (y1>2) then begin gotoxy(1,y1); write(' '); dec(y1); gotoxy(1,y1); write(']>'); end; if (ch='k') and (y1<20) then begin gotoxy(1,y1); write(' '); inc(y1); gotoxy(1,y1); write(']>'); end; if (ch='q') then break; if (ch='f')and(xz1=0) then begin xz1:=3; yz1:=y1; end; {play2} if (ch='8') and (y2>2) then begin gotoxy(39,y2); write(' '); dec(y2); gotoxy(39,y2); write('<['); end; if (ch='5') and (y2<20) then begin gotoxy(39,y2); write(' '); inc(y2); gotoxy(39,y2); write('<['); end; if (ch='0')and(xz2=0) then begin xz2:=37; yz2:=y2; end; end;{end of keyprssed} if (t1 mod 5=0)and(xz1<>0) then begin if xz1>38 then begin gotoxy(xz1,yz1); write(' '); if yz1=y2 then Over(2); xz1:=0; yz1:=0; end else begin gotoxy(xz1,yz1); write(' .'); inc(xz1); end; end; {play2} if (t1 mod 5=0)and(xz2<>0) then begin if xz2<2 then begin gotoxy(xz2,yz2); write(' '); if yz2=y1 then Over(1); xz2:=0; yz2:=0; end else begin gotoxy(xz2-1,yz2); write('. '); dec(xz2); end; end; end;{end of while} end; {end of go} begin start; go; end.
/
本文档为【Free Pascal 射击游戏】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
热门搜索

历史搜索

    清空历史搜索