⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c语言编的仿linux下ktron的街机游戏,对以前发的有点小修改_c语言游戏编程_c游戏编程_c语言_c 语言之家.htm

📁 BBS上淘来的一大堆C源代码
💻 HTM
📖 第 1 页 / 共 4 页
字号:
          <TD width=20 
          background="C语言编的仿LINUX下KTron的街机游戏,对以前发的有点小修改_C语言游戏编程_C游戏编程_C语言_C 语言之家.files/banbg.gif"> </TD>
          <TD width=530 
          background="C语言编的仿LINUX下KTron的街机游戏,对以前发的有点小修改_C语言游戏编程_C游戏编程_C语言_C 语言之家.files/banbg.gif" 
          height=20>当前位置:<A class=class 
            href="http://www.cstudyhome.com/wenzhang06/">网站首页</A>&gt;&gt;<A 
            class=class 
            href="http://www.cstudyhome.com/wenzhang06/type.asp?typeid=11">C语言</A>&gt;&gt;<A 
            class=class 
            href="http://www.cstudyhome.com/wenzhang06/BigClass.asp?typeid=11&amp;BigClassid=34">C游戏编程</A>&gt;&gt;<A 
            class=class 
            href="http://www.cstudyhome.com/wenzhang06/SmallClass.asp?typeid=11&amp;BigClassID=34&amp;SmallClassID=61">C语言游戏编程</A></TD>
          <TD width=107 
          background="C语言编的仿LINUX下KTron的街机游戏,对以前发的有点小修改_C语言游戏编程_C游戏编程_C语言_C 语言之家.files/banbg.gif" 
          height=20>双击自动滚屏</TD>
          <TD width=91 
          background="C语言编的仿LINUX下KTron的街机游戏,对以前发的有点小修改_C语言游戏编程_C游戏编程_C语言_C 语言之家.files/banbg.gif"><INPUT onclick="window.close();return false;" type=button value=关闭窗口 name=close> 
          </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#e2ca9f cellSpacing=0 
cellPadding=0 width=750 align=center border=3>
  <TBODY>
  <TR><!--<td width="20%" align="middle" valign="top" background="images/002.jpg" bordercolor="#e2ca9f"> </td> 
<td width="80%">-->
    <TD width="100%">
      <TABLE borderColor=#e2ca9f cellSpacing=0 cellPadding=0 width="100%" 
      border=0>
        <TBODY>
        <TR>
          <TD vAlign=top align=middle width="95%">
            <TABLE borderColor=#e2ca9f cellSpacing=0 cellPadding=0 width="100%" 
            border=1>
              <TBODY>
              <TR>
                <TD vAlign=top borderColor=#e2ca9f align=middle width="69%" 
                background="C语言编的仿LINUX下KTron的街机游戏,对以前发的有点小修改_C语言游戏编程_C游戏编程_C语言_C 语言之家.files/002.jpg">
                  <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center 
                  border=0>
                    <TBODY>
                    <TR>
                      <TD width="100%" height=40></TD></TR>
                    <TR>
                      <TD>
                        <FORM name=form1 
                        action=Readnews.asp?newsid=6163&amp;id2=6163 
method=post>
                        <CENTER><!-- <input type=submit name=aa value="点击关闭浮动图标" width=20 title="点击广告支持本站">--></CENTER></FORM></TD></TR>
                    <TR>
                      <TD style="FONT-SIZE: 18px" vAlign=bottom align=middle 
                      width="85%" bgColor=#dddddd height=20><STRONG><FONT 
                        color=#003399 
                        size=4><B>C语言编的仿LINUX下KTron的街机游戏,对以前发的有点小修改 
                        </B></FONT></STRONG></TD><BR></TR>
                    <TR>
                      <TD align=middle width="100%"><BR></TD></TR>
                    <TR>
                      <TD style="FONT-SIZE: 9pt" align=middle 
                        width="100%">发表日期:2005年12月21日&nbsp;&nbsp;出处:原创&nbsp;&nbsp;作者:gaowenfeng&nbsp;&nbsp;已经有1894位读者读过此文</TD></TR>
                    <TR>
                      <TD align=middle width="100%"><!--下面的这一句是设置阅读文本区的宽度-->
                        <TABLE style="TABLE-LAYOUT: fixed" cellSpacing=0 
                        cellPadding=0 width="90%" align=center border=0>
                          <TBODY>
                          <TR>
                            <TD align=middle width="100%"></TD></TR>
                          <TR>
                            <TD style="WORD-WRAP: break-word"><FONT 
                              class=news><BR>
                              <P>********************************游戏说明*************************************</P>
                              <P>本程序用于各位朋友研究C语言之用,可以任意传播,转贴请注明出处,谢谢!</P>
                              <P>Trone V0.11</P>
                              <P>此版对V0.1版中有一点小问题有所改进,一年多时间我也没怎么动她了,因为也没有什么时间,望大家谅解!<BR>下个版本中可能会增加一些可玩性的游戏,比如文本(或图形)环境下的推箱子游戏,贪食蛇等!由于没有时间到各论坛给大家回复,所以希望大家在我的网页上发表建议,你也可以写代码加到程序里去,我在这里先谢了!<BR>要发言,也可以进入我的网站的留言板,下载也在这里(包括全源代码文件,编译通过的文件,EGAVGA.BGI文件,说明文件),我已经把它打成一个RAR自解压包,链接见下:</P>
                              <P><A 
                              href="http://www.ourwp.com/c.htm">http://www.ourwp.com/c.htm</A></P>
                              <P>如果您要下载TC2.0全部文件,请直接与我QQ联系,谢谢!</P>
                              <P>*******************************************************************************<BR>Trone 
                              V0.1<BR>仿LINUX下街机游戏KTron。<BR>其实写本游戏的动机就是我一个朋友特别喜欢linux下的KTron这个游戏,<BR>但在WINDOWS下又没找到,而我朋友又不太熟悉LINUX操作,所以我就花了点时间写了Trone,<BR>Trone这个名字也是源于KTron。</P>
                              <P>注意:此游戏需要EGAVGA.BGI文件才能运行,该文件在turboc2目录下可找到。</P>
                              <P>[游戏简介]<BR>这是一个双人玩的策略游戏,游戏有两个点,<BR>第一个游戏者可以按R,G,F,D控制第一个点的走向,<BR>第两个游戏都可以按四个光标键控制第二个点的走向,<BR>谁先碰到边界或已走的路线便输,祝大家玩得开心!!!<BR>有任何问题或建议请与我联系。</P>
                              <P>请不要删除此文件,有新功能增加可加在下面:</P>
                              <P>[Trone 
                              V0.1]功能简介<BR>游戏者1控制键:R,F,D,G<BR>游戏者2控制键:UP,DOWN,LEFT,RIGHT<BR>F1:查看帮助信息<BR>F2:设定游戏速度等级,0为最快,1为正常,2最慢<BR>F3:设定游戏者1的颜色,有15种颜色可以选择,黑色是背景色,不能选<BR>F4:设定游戏者2的颜色<BR>F5:继续游戏</P>
                              <P>。<BR>。<BR>。</P>
                              <P>****************************源代码**********************************</P>
                              <P>#include &lt;time.h&gt;<BR>#include 
                              &lt;stdlib.h&gt;<BR>#include 
                              &lt;conio.h&gt;<BR>#include 
                              &lt;ctype.h&gt;<BR>#include 
                              &lt;stdio.h&gt;<BR>#include 
                              &lt;graphics.h&gt;<BR>#include &lt;bios.h&gt;</P>
                              <P>/* 功能键设置 */</P>
                              <P>#define&nbsp;ESC&nbsp;0x001b&nbsp;/* 退出游戏 
                              */<BR>#define&nbsp; F1&nbsp;&nbsp;0x3b00&nbsp;/* 
                              查看帮助信息,调用HelpMassage()函数 */<BR>#define 
                              &nbsp;F2&nbsp;&nbsp;0x3c00&nbsp;/* 
                              设定游戏速度等级,调用Set_Level()函数 
                              */<BR>#define&nbsp;F3&nbsp;&nbsp;0x3d00&nbsp;/* 
                              设定游戏者1的颜色,调用Set_Color()函数 
                              */<BR>#define&nbsp;F4&nbsp;&nbsp;0x3e00&nbsp;/* 
                              设定游戏者2的颜色,调用Set_Color()函数 
                              */<BR>#define&nbsp;F5&nbsp;&nbsp;0x3f00&nbsp;/* 
                              以下功能键暂时保留,如果增加功能可使用 
                              */<BR>#define&nbsp;F6&nbsp;&nbsp;0x4000<BR>#define&nbsp;F7&nbsp;&nbsp;0x4100<BR>#define&nbsp;F8&nbsp;&nbsp;0x4200<BR>#define&nbsp;F9&nbsp;&nbsp;0x4300<BR>#define&nbsp;F10&nbsp;0x4400</P>
                              <P>/* Player1 hot key 游戏者1热键上下左右分别用RFDG控制 
                              */<BR>#define RIGHT1&nbsp;71<BR>#define 
                              LEFT1&nbsp;68<BR>#define UP1&nbsp;82<BR>#define 
                              DOWN1&nbsp;70</P>
                              <P>/* Player2 hot key 游戏者2热键,四个光标键控制方向 
                              */<BR>#define&nbsp;RIGHT&nbsp;0x4d00<BR>#define&nbsp;LEFT&nbsp;0x4b00<BR>#define&nbsp;UP&nbsp;0x4800<BR>#define&nbsp;DOWN&nbsp;0x5000</P>
                              <P><BR>/* 定义画方框的坐标X,Y,以及颜色Color,Draw为是(1)否(0)已走过 
                              */<BR>struct 
                              information<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;int 
                              color,draw;<BR>&nbsp;&nbsp;&nbsp;int 
                              x,y;<BR>&nbsp;&nbsp;};<BR>typedef struct 
                              information INFOR;</P>
                              <P>/* 记录游戏者在把在位置,X与Y其实就是全局数组coordinate[][]的两个下标 
                              */<BR>struct 
                              playerxy<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;int 
                              x,y;<BR>&nbsp;&nbsp;};<BR>typedef struct playerxy 
                              CurrentCoor;</P>
                              <P>/* 此全局数组是记录画每个框的坐标及颜色以及是否已走过 */<BR>INFOR 
                              coordinate[80][60];</P>
                              <P>time_t Timeout=1;&nbsp; /* 
                              限制游戏的快慢,可用Set_Level()设定 */</P>
                              <P>int size=8,maxX=79,maxY=56; /* 
                              size定义画框的大小,单位为像素,maxX,maxY为数组coordinate下标的最大值 
                              */</P>
                              <P>/* 
                              BackColor为游戏背景色,Player1Color与Player2Color为游戏者默认颜色,可调用Set_Color()函数设定 
                              */<BR>int 
                              BackColor=BLACK,Player1Color=WHITE,Player2Color=LIGHTRED;</P>
                              <P>&nbsp;</P>
                              <P>/* 初始化图形模式 */<BR>void 
                              InitialGraphics(void)<BR>{<BR>&nbsp;int 
                              graphdriver=VGA,graphmode=VGAHI;<BR>&nbsp;int 
                              errorcode;<BR>&nbsp;initgraph(&amp;graphdriver,&amp;graphmode,"");<BR>&nbsp;errorcode=graphresult();<BR>&nbsp;if(errorcode!=grOk)<BR>&nbsp;{<BR>&nbsp;&nbsp;printf("Graphics 
                              error:%s\n",grapherrormsg(errorcode));<BR>&nbsp;&nbsp;GoodBye();<BR>&nbsp;}<BR>}</P>
                              <P>/* 退出游戏显示提示信息,只有不能初始化图形界面才会调用此函数 */<BR>int 
                              GoodBye(void)<BR>{<BR>&nbsp;printf("Thank you very 
                              much!\n");<BR>&nbsp;printf("If you have any 
                              question,\n");<BR>&nbsp;printf("Please send email 
                              to me: <A 
                              href="mailto:hostadmin@163.com">hostadmin@163.com</A> 
                              or Add QQ:277566252\n");<BR>&nbsp;printf("If you 
                              have not Trouble C 2.0 
                              files,\n");<BR>&nbsp;printf("you can download them 
                              from <A 
                              href="http://www.ourwp.com/c.htm">http://www.ourwp.com/c.htm</A> 
                              !");<BR>&nbsp;GetKey();<BR>&nbsp;exit(0);<BR>}</P>
                              <P>/* 初始化游戏界面 */<BR>void 
                              InitFace(void)<BR>{<BR>&nbsp;setbkcolor(BackColor);<BR>&nbsp;cleardevice();<BR>&nbsp;setcolor(WHITE);<BR>&nbsp;rectangle(0,0,639,479);<BR>&nbsp;setcolor(LIGHTGREEN);<BR>&nbsp;rectangle(3,3,636,452);<BR>&nbsp;setcolor(LIGHTRED);<BR>&nbsp;rectangle(3,455,250,476);<BR>&nbsp;rectangle(253,455,636,476);</P>
                              <P>}</P>
                              <P>/* 初始化全局数组coordinate[][] */<BR>void 
                              InitCoordinate(void)<BR>{<BR>&nbsp;int 
                              x,y;<BR>&nbsp;for(x=0;x&lt;maxX;x++)<BR>&nbsp;&nbsp;for(y=0;y&lt;maxY;y++)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;coordinate[x][y].color=BackColor;<BR>&nbsp;&nbsp;&nbsp;coordinate[x][y].draw=0;<BR>&nbsp;&nbsp;&nbsp;coordinate[x][y].x=size*x+4;<BR>&nbsp;&nbsp;&nbsp;coordinate[x][y].y=size*y+4;<BR>&nbsp;&nbsp;}<BR>}</P>
                              <P>/* 初始化游戏者开始位置 */<BR>void 
                              InitPlayerPlace(CurrentCoor *player1,CurrentCoor 
                              *player2)<BR>{<BR>&nbsp;player1-&gt;x=maxX/3;<BR>&nbsp;player2-&gt;x=maxX/3*2;<BR>&nbsp;player1-&gt;y=maxY/2;<BR>&nbsp;player2-&gt;y=maxY/2;<BR>}</P>
                              <P>/* 画框函数,player为画框位置,who为哪一个游戏者 */<BR>void 
                              Drawbar(CurrentCoor player,int 
                              who)<BR>{<BR>&nbsp;int x,y;&nbsp;/* 
                              根据游戏者所在coordinate的下标位置取出在屏幕上的位置 
                              */<BR>&nbsp;x=coordinate[player.x][player.y].x;<BR>&nbsp;y=coordinate[player.x][player.y].y;<BR>&nbsp;if(who==1)<BR>&nbsp;&nbsp;{&nbsp;setfillstyle(1,Player1Color);<BR>&nbsp;&nbsp;&nbsp;coordinate[player.x][player.y].color=Player1Color;<BR>&nbsp;&nbsp;}<BR>&nbsp;else<BR>&nbsp;&nbsp;{&nbsp;setfillstyle(1,Player2Color);<BR>&nbsp;&nbsp;&nbsp;coordinate[player.x][player.y].color=Player2Color;<BR>&nbsp;&nbsp;}<BR>&nbsp;bar(x,y,x+7,y+7);<BR>&nbsp;coordinate[player.x][player.y].draw=1;<BR>}</P>
                              <P>/* 帮助信息,按F1调用此函数 */<BR>void 
                              HelpMassage(void)<BR>{<BR>&nbsp;setfillstyle(1,WHITE);<BR>&nbsp;bar(150,160,500,340);<BR>&nbsp;setcolor(LIGHTRED);<BR>&nbsp;rectangle(152,162,498,338);<BR>&nbsp;setcolor(BLACK);<BR>&nbsp;rectangle(154,164,496,180);<BR>&nbsp;rectangle(154,182,496,336);<BR>&nbsp;setcolor(GREEN);<BR>&nbsp;outtextxy(280,170,"Trone 
                              V0.11");<BR>&nbsp;setcolor(BLACK);<BR>&nbsp;outtextxy(160,190,"Player1 
                              control 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -