#include <graphics.h>
#include <time.h>
#include <iostream>
using namespace std;
void main()
{
srand((unsigned)time(NULL)); // 随机种子
initgraph(500, 400);// 打开图形窗口
char name[10];
char difficult[2];
InputBox(name, 10, "请输入你的名字(仅限英文与数字)");
InputBox(difficult,2,"请输入难度(1~4如果乱输后果自负)");
int nandu;
sscanf(difficult, "%d", &nandu);
int thing[26][3];//thing[ID][1.生命2.攻击3.防御](1~4为物品5为路6~25为怪物26为墙)
int map[19][19];
int com_walk[19][19];
int com_foot;
int com_gongji=10;
int com_fangyu=10;
int com_shengmin=1000;
int wrong=1;
//设置出生点
int chusheng_x=0,chusheng_y=0,zhongdian_x=0,zhongdian_y=0;
chusheng_x= rand() % 19 + 1;
chusheng_y= rand() % 19 + 1;
//设置物品
//红宝石
thing[1][2]=1;
//蓝宝石
thing[2][3]=1;
//红血瓶
thing[3][1]=100;
//蓝血瓶
thing[4][1]=200;
while(com_foot>=nandu*80)||wrong)
{
closegraph(); // 关闭图形窗口
}
这是现在的代码,c++写的,用的图形库是eazyx,大家可以帮忙出出点子,有问题我就在贴里说了