仿LINUX下KTron地游戏
*****************************游戏说明***********************************
Trone V0.1
仿LINUX下街机游戏KTron。
其实写本游戏的动机就是我一个朋友特别喜欢linux下的KTron这个游戏,
但在WINDOWS下又没找到,而我朋友又不太熟悉LINUX操作,所以我就花了点时间写了Trone,
Trone这个名字也是源于KTron。
注意:此游戏需要EGAVGA.BGI文件才能运行,该文件在turboc2目录下可找到。
[游戏简介]
这是一个双人玩的策略游戏,游戏有两个点,
第一个游戏者可以按R,G,F,D控制第一个点的走向,
第两个游戏都可以按四个光标键控制第二个点的走向,
谁先碰到边界或已走的路线便输,祝大家玩得开心!!!
有任何问题或建议请与我联系。
此游戏可任意复制,作者保留所有权力!
如果你想要源代码,那么请发邮件给我。
请不要删除此文件,有新功能增加可加在下面:
[Trone V0.1]功能简介
游戏者1控制键:R,F,D,G
游戏者2控制键:UP,DOWN,LEFT,RIGHT
F1:查看帮助信息
F2:设定游戏速度等级,0为最快,1为正常,2最慢
F3:设定游戏者1的颜色,有15种颜色可以选择,黑色是背景色,不能选
F4:设定游戏者2的颜色
F5:继续游戏
。
。
。
Author:jadewater(gaowenfeng)
email:hostadmin@163.com
QQ:182824199
如果这里不能下载你可以发邮件给我,其中包括4个文件:Trone.c(源代码),Trone.exe(已编译连接游戏文件),EGAVGA.BGI,游戏说明.txt
*******************************************************************************
这个游戏已编译成可执行文件,可以在附件里找到,如果你不能编译的话可以与我联系,
我可以把已编译的程序与源文件全发给你。
下面的全是原代码。转载请注明作者,谢谢!!
共享是这个时代的主题!!:)
*******************************************************************************
#include <time.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include <stdio.h>
#include <graphics.h>
#include <bios.h>
/* 功能键设置 */
#define ESC 0x001b /* 退出游戏 */
#define F1 0x3b00 /* 查看帮助信息,调用HelpMassage()函数 */
#define F2 0x3c00 /* 设定游戏速度等级,调用Set_Level()函数 */
#define F3 0x3d00 /* 设定游戏者1的颜色,调用Set_Color()函数 */
#define F4 0x3e00 /* 设定游戏者2的颜色,调用Set_Color()函数 */
#define F5 0x3f00 /* 以下功能键暂时保留,如果增加功能可使用 */
#define F6 0x4000
#define F7 0x4100
#define F8 0x4200
#define F9 0x4300
#define F10 0x4400
/* Player1 hot key 游戏者1热键上下左右分别用RFDG控制 */
#define RIGHT1 71
#define LEFT1 68
#define UP1 82
#define DOWN1 70
/* Player2 hot key 游戏者2热键,四个光标键控制方向 */
#define RIGHT 0x4d00
#define LEFT 0x4b00
#define UP 0x4800
#define DOWN 0x5000
/* 定义画方框的坐标X,Y,以及颜色Color,Draw为是(1)否(0)已走过 */
struct information
{
int color,draw;
int x,y;
};
typedef struct information INFOR;
/* 记录游戏者在把在位置,X与Y其实就是全局数组coordinate[][]的两个下标 */
struct playerxy
{
int x,y;
};
typedef struct playerxy CurrentCoor;
/* 此全局数组是记录画每个框的坐标及颜色以及是否已走过 */
INFOR coordinate[80][60];
time_t Timeout=1; /* 限制游戏的快慢,可用Set_Level()设定 */
int size=8,maxX=79,maxY=56; /* size定义画框的大小,单位为像素,maxX,maxY为数组coordinate下标的最大值 */
/* BackColor为游戏背景色,Player1Color与Player2Color为游戏者默认颜色,可调用Set_Color()函数设定 */
int BackColor=BLACK,Player1Color=WH99vE,Player2Color=LIGHTRED;
/* 初始化图形模式 */
void InitialGraphics(void)
{
int graphdriver=VGA,graphmode=VGAHI;
int errorcode;
initgraph(&graphdriver,&graphmode,"");
errorcode=graphresult();
if(errorcode!=grOk)
{
printf("Graphics error:%s\n",grapherrormsg(errorcode));
GoodBye();
}
}
/* 退出游戏显示提示信息,只有不能初始化图形界面才会调用此函数 */
int GoodBye(void)
{
printf("Thank you very much!\n");
printf("If you have any question,\n");
printf("Please send email to me: hostadmin@163.com or Add QQ:182824199\n");
GetKey();
exit(0);
}
/* 初始化游戏界面 */
void InitFace(void)
{
setbkcolor(BackColor);
cleardevice();
setcolor(WH99vE);
rectangle(0,0,639,479);
setcolor(LIGHTGREEN);
rectangle(3,3,636,452);
文章评论
共有 0人发表了评论 查看完整内容