c语言简单小游戏(模拟魔塔)

比较渣的小游戏:::供像我一样的初学者学习或做着玩

下面是一些怪物说明   和操作说明:

1:怪物以及道具说明**********************************************************

叱咤风云特殊道具代号:

银剑 ╃:攻击增加50
银盾 @:防御增加50
圣剑 →:攻击*2
圣盾 】:防御*2
攻击宝石 ♂: 攻击加5
防御宝石♀: 防御加5
生命药水#:  血量加1000
神圣之剑┞: 攻击加800
神圣之盾&: 防御加500

\3圣神之心 生命值加12000

叱咤风云怪物字符代号:

 0青头怪 \1 攻击15 防御10 血量100
1骷髅人  € 攻击30 防御15 血量150
2骷髅士兵 ※攻击40 防御20 血量300
3小蝙蝠  ¤ 攻击28 防御12 血量120
4大蝙蝠  ┳ 攻击42 防御24 血量350
5骷髅队长 ◎ 攻击60 防御30 血量500
6初级卫兵 ○ 攻击100 防御50 血量1000
7冥卫兵   ● 攻击150 防御80 血量1400
8白衣武士 ↑ 攻击200 防御100 血量2000
9金队长   \2 攻击300 防御120 血量3000
10魔王(幻影)◇ 攻击800 防御400 血量6000
飞哥(护法)№ 攻击1000 防御500 血量10000
伟哥(护法) ☆  攻击1000 防御500 血量10000
大锐哥(魔王) ◆  攻击2000 防御1000 血量20000
******************************************************************************************************************************

2.操作说明**********************************************************************

操作说明:走到与怪重合的位置,自动打怪(与魔塔稍有不同)
方向键控制移动,A键查看自己的属性,S键关闭属性栏,D查看
当前关卡提示(第二关才有)     F商店,可强化自身属性  G查看自身金钱
第二关一开始会获得圣神祝福:攻击加100,防御加50
最后一关会受到魔王的诅咒,生命-8000
提示:尽量用4来提升自身属性,必要时,直接全加3
第二关和第三关第一层可以穿墙得宝物,但第三关第一层的圣剑
尽量不要提前拿............
怪物有所改动,但是强弱关系不变

******************************************************************************

3.   5个地图文件

叱咤风云地图1      (就以这个(叱咤风云地图1)作为第一个TXT文件名,把下面这一大串数字拷贝进这个TXT文件中,然后把所有的TXT文件和代码文件以及可执行文件都放在桌面上或者都放在桌面上的同一个文件夹里)++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000301010101010101010101010101010101010101010101010101010101040000020000000000000000000000000000000000000000000000000000000002000002000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000020000020000000000000000000000000000000000000000000000000000000002000005010101010101010101010101010101010104000002000200000000000200000200000000000000000000000000000000000200000200020000000000020000020003010101010101010101010101010400020000020002000000000002000002000200000000000000000000000000020002000002000200000000000200000200020000000000000000000000000002000200000200020000000000020000020002000000000000000000000000000200020000020002000000000002000002000501010101010101010104000000020002000002000200000000000200000200000000000000000000000200000002000200000200020000000000020000050101010101010101040000020000000200020000020002000000000002000002000000000000000002000002000000020002000002000200000000000200000200000000000000000200000200000002000200000200020000000000020000020000000000000000020000020000000200020000020002000000000002000002000000000000000002000002000000020002000002000200000000000200000501010101010101010600000200000002000200000200020000000000020000020000000000000000000000020000000200020000020002000000000002000002000301010101010101010106000000020005010106000200000000000200000200020000000000000000000000000002000000000000020000000000020000020002000000000000000000000000000200030101010106000000000002000002000200000000000000000000000000020002000000000000000000000200000200020000000000000000000000000002000200000000000000000000020000050105010101010101010101010101010501050101010101010101010106000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000



+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

叱咤风云地图2(同理)++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000301010101010101010101010101010101010101010101010101010101040000020000030101010101010400000000000000000000000000000000000002000002000002000000000000020000000000000000000000000000000000000200000200000200030101040002000000000000000000000000000000000000020000020000020002030106000200000000000000000000000000000000000002000002000002000202000000020000000000000000000000000000000000000200000200000200020200030106000000000000000000000000000000000000020000020000020002020002000000000000000000000000000000000000000002000002000002000202000200000000000000000000000000000000000000000200000200000200020200020000000000000000000000000000000000000000020000020000020002020002000000000000000000000000000000000000000002000005010106000202000501010101040000000000000000000000000000000200000200000000020200000000000002000000000000000000000000000000020000020003010106050101010104000200000000000000000000000000000002000002000200000200000000000200020000000000000000000000000000000200000200020000020003010101060002000000000000000000000000000000020000020002000002000200000000000200000000000000000000000000000002000002000200000200020003010101060000000000000000000000000000000200000200020000020002000200000000000000000000000000000000000000020000020002000002000200050101010101010100000000000000000000000002000002000200000200020000000000000000000000000000000000000000000200000200020000020005010101010101010101000000000000000000000000020000020002000002000000000000000000000000000000000000000000000002000002000200000200000000000000000000000000000000000000000000000200000200020000020000000000000000000000000000000000000000000000020000050105010105010101010101010101010101010101010101010101010106000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000



+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

叱咤风云地图3-1  (注意:这个地图名是 叱咤风云地图3-1)(注意:这个地图拷贝下列字符,两行加号中间的字符,不包含这两行加号)+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〳〱〱〱〴〱〱〱〴〱〱〳〱〱〱〴〱〱〱〱〱〱〱〱〳〱〱〱〱〴〰〰〲〰〰〰〲〰〰〰〲〰〰〲〰〰〰〲〰〰〰〰〰〰〰〰〲〰〰〰〰〲〰〰〲〰〰〰〲〰〱〱〶〰〰〵〱〱〰〰〰〰〰〰〰〰〰〰〲〰〰〰〰〲〰〰〲〰〰〰〲〰〰〰〰〰〰〰〰〰〰〰〰〰〳〱〱〱〱〱〶〰〰〰〰〲〰〰〲〰〰〰〲〰〰〰〰〰〰〰〰〰〰〰〰〰〲〰〰〰〰〰〰〰〰〰〰〲〰〰〲〰〰〰〲〰〰〰〰〰〰〰〰〰〰〰〰〰〲〰〳〱〳〱〱〱〱〱〱〴〰〰〲〰〰〰〲〰〰〰〰〰〰〰〰〰〰〰〰〰〲〰〲〰〲〰〰〰〰〰〰〲〰〰〲〰〰〰〲〰〰〰〰〰〰〰〰〳〱〱〱〱〶〰〲〰〲〰〰〰〰〰〰〲〰〰〲〰〰〰〲〳〱〱〱〴〰〰〰〲〰〰〰〰〰〰〲〰〰〰〰〰〰〰〰〲〰〰〲〰〰〰〲〲〰〰〰〲〰〰〰〲〰〳〱〱〱〱〶〰〵〱〱〱〱〱〱〶〰〰〲〰〰〰〲〲〰〰〰〲〰〰〰〲〰〲〰〰〰〰〰〰〰〰〰〰〰〰〰〲〰〰〲〰〰〰〲〲〰〰〰〲〰〰〰〲〰〲〰〰〰〰〰〰〰〰〰〰〰〰〰〲〰〰〲〰〰〰〲〲〰〰〰〲〰〰〰〲〰〲〰〰〰〰〰〰〰〰〰〰〰〰〰〲〰〰〲〰〰〰〰〰〰〰〰〰〰〵〱〶〰〲〰〰〰〰〰〰〰〰〳〱〱〱〱〴〰〰〲〰〰〰〲〲〰〰〰〲〰〰〰〰〰〲〰〰〰〰〰〰〰〰〲〰〰〰〰〲〰〰〲〰〰〰〲〲〰〰〰〲〰〳〱〱〱〶〰〰〰〰〰〰〰〰〲〰〰〰〰〲〰〰〲〰〰〰〲〲〰〰〰〲〰〳〱〱〱〴〰〰〰〰〰〰〰〰〲〰〰〰〰〲〰〰〵〱〱〱〶〵〱〱〱〶〰〲〰〰〰〲〰〰〰〰〰〰〰〰〲〰〰〰〰〲〰〰〲〰〰〰〰〰〰〰〰〰〰〲〰〰〰〲〰〰〰〰〰〰〰〰〲〰〰〰〰〲〰〰〲〰〳〱〴〰〰〰〰〰〰〵〱〱〱〶〰〰〰〰〰〰〰〰〲〰〰〰〰〲〰〰〲〰〲〰〲〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〲〰〰〰〰〲〰〰〲〰〲〰〲〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〲〰〰〰〰〲〰〰〲〰〲〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〲〰〰〰〰〲〰〰〲〰〲〰〲〰〱〱〴〰〰〳〱〱〱〱〱〱〰〰〰〰〰〰〲〰〰〰〰〲〰〰〲〰〲〰〲〰〰〰〲〰〰〲〰〰〰〰〰〰〰〲〰〰〰〰〰〰〰〰〰〲〰〰〵〱〵〱〶〱〱〱〵〱〱〶〱〱〱〱〱〱〱〶〱〱〱〱〱〱〱〱〱〶〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰〰



+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

叱咤风云地图3-2      (拷贝)+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000301010101010301010104010101010101010101010101010101010101040000020000000000020000000200000000000000000000000000000000000002000002000000000002000000020000000000000000000000000000000000000200000200000000000200000002000000000000000000000000000000000000020000020000000000050101010600000000000000000000000000000000000002000002000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000020000020000000000000000000000000000000000000000000000000000000002000002000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000020000020000000000000000000000000000000000000000000000000000000002000002000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000020000020000000000000000000000000000000000000000000000000000000002000002000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000020000020000000000000000000000000000000000000000000000000000000002000003010101010101010400000000000000000000000000000000000000000200000200000000000000020000000000000000000000000000000000000000020000020000000000000002000000000000000000000000000000000000000002000002000000000000000200000000000000000000000000000000000000000200000200000000000000020000000000000000000000000000000000000000020000020000000000000002000000000000000000000000000000000000000002000002000000000000000200000000000000000000000000000000000000000200000200000000000000020000000000000000000000000000000000000000020000050101010101010106010101010101010101010101010101010101010106000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

叱咤风云地图3-3(拷贝)+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000301010101010101010101010101010101010101010101010101010101040000020000000000000000000000000000000000000000000000000000000002000002000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000020000020000000000000000000000000000000000000000000000000000000002000002000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000020000020000000000000000000000000000000000000000000000000000000002000002000000000000000000000000000000000000000000000000000000000200000200000000000000000301040000000000000000000000000000000000020000020000000000000000020002000000000000000000000000000000000002000002000000000000000005000600000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000020000020000000000000000000000000000000000000000000000000000000002000002000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000020000020000000000000000000000000000000000000000000000000000000002000002000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000020000020000000000000000000000000000000000000000000000000000000002000002000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000020000020000000000000000000000000000000000000000000000000000000002000002000000000000000000000000000000000000000000000000000000000200000200000000000000000000000000000000000000000000000000000000020000050101010101010101010101010101010101010101010101010101010106000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

我再强调一遍,一定要按我说的做,把这些数字(3-1是字符)按照开头我写的名字命名TXT文件,分别写到5个TXT文件中(手动拷贝就行),然后,把所有的这些

TXT文件 以及代码文件和生成的可执行文件 都放在桌面上 或者 桌面上建的一个文件夹中,然后运行该代码,即可体验简陋版魔塔....哈哈哈...是中秋特别版的

记得膜拜我哈,有buff加成的(特别提醒:有作弊键的,想知道是哪几个键就自己 研究代码吧,嘻嘻......告辞.........)


#include

#include
#include
#include
#include
#include
#define FrameX 4//x :4-62
#define FrameY 4//y :4-34
#define Frame_width 30
#define Frame_height 25
int m=0;
int isdie=0;//判断自己是否死亡
int map[35][66];//定义地图数组
int batt=1;//关卡数
int cs=1;//层数(第三关开始有)
int is=0;//判断是否初始化地图
int money=0;//将打怪获得的金钱放在一个整形变量中
int ak=0;
int ac1=0;
int flag=0;
struct holysword
{
    int x;
    int y;
};//定义一些剑盾的结构体
struct attribute
{
    char name[30];
    int x;
    int y;
    int health;
    int attack;
    int defend;
};// 定义自己和敌人的基本属性
struct attribute enemy[11][50];//定义敌人
struct attribute  ddi[50];//防御宝石
struct attribute adi[50];//攻击宝石
struct attribute hdi[50];//血瓶
void enemymake();//制造敌人
void enemyprint();//打印敌人
void enemyplace();//放置敌人
void battlesite(struct attribute *me,int i,int j);//战斗场景即战斗时的框
void setWindowsSize(int w,int h);//游戏窗口设置
void MainMenu();//一开始游戏界面初始化
void Gotoxy(int x,int y);//光标移动
void Hide();//隐藏光标
void moveme(struct attribute *me);//移动我自己
void printme(struct attribute *me);//打印我自己
void battle(struct attribute *me,int i,int j);//战斗数据变化设置
void overgame();//游戏结束界面显示
void victory();//游戏胜利
void mapmake();//制作地图
void mapprint();//打印地图
void mapload();//加载地图
void atplace();//道具放置
void atprint();//道具打印
void attributeprint(struct attribute *me);
int main()
{
    for(int i=0;i<50;++i)
    {
        ddi[i].x=150;
        ddi[i].y=150;
         adi[i].x=150;
        adi[i].y=150;
         hdi[i].x=150;
        hdi[i].y=150;
    }//先置空宝石和药水
    struct holysword sword;//圣剑
    struct holysword shield;//圣盾
    struct holysword msword;//银剑
    struct holysword mshield;//银盾
    struct holysword godsword;//神圣之剑
    struct holysword godshield;//神圣之盾
     setWindowsSize(180,80);//设置窗口大小
    Hide();//隐藏光标
    printf("游戏加载中,请稍等");
    Sleep(10000);//设置基本属性并延迟半秒
    system("cls");//清屏
    MainMenu();//显示初始菜单
    system("cls");
    Sleep(2000);
      struct attribute *me,I;//定义自己
    me=&I;
    me->x=FrameX+2;
    me->y=FrameY+Frame_height-1;
    me->attack=20;
    me->defend=10;
    me->health=4000;//设置自己的属性
       printf("请输入你的名字\n");
    scanf("%s",me->name);
    system("cls");
      printf("请按任意键开始游戏");
      char s;
    s=getch();
    system("cls");
    printf("很久很久以前,面对魔种入侵,一位名叫%s的英雄出现了\n",me->name);//开场剧情设置
    Sleep(2000);
    printf("他承载着实现国家爱与和平的使命,从此踏上了征途\n");
    Sleep(2000);
    printf("故事从此开始了.........\n");
    printf("(按任意键继续)");
    getch();
    system("cls");
    printf("欢迎来到中秋特别版,本版本福利多多哦\n");
    printf("(按任意键继续)");
    getch();
    system("cls");
    printf("是否膜拜制作人豪哥?膜拜有奖哦\n");
    printf("1.膜拜 2.不膜拜 3.仍一个粑粑给制作人");
     char ac;
     ac=getch();
    switch(ac)
    {
     case '1':
        system("cls");
        printf("恭喜你获得buff攻击加5,生命加500\n");
        printf("按任意键继续");
        getch();
        me->attack+=5;
        me->health+=500;
        system("cls");
        break;
     case '2':
        system("cls");
        printf("豪哥甩了一张瓜皮脸给你,并向你的排位扔了4个小学生\n");
        printf("按任意键继续");
        getch();
        system("cls");
        break;
     case '3':
        system("cls");
        printf("豪哥非常不开心,但是大度的豪哥给你一个选择的机会\n");
        printf("1.豪哥太帅了 2.丑比");
        ac=getch();
        switch(ac)
        {
           case '1':
               system("cls");
                printf("可以,可以,豪哥奖励你防御3点,生命300点\n");
                printf("按任意键继续");
                getch();
                system("cls");
                me->defend+=3;
                me->health+=300;
                break;
           case '2':
               system("cls");
               printf("你惹豪哥生气了,豪哥要施罚于你\n");
               printf("你的攻击减少2点,你的防御减少2点\n");
               printf("按任意键继续");
               getch();
               me->attack-=2;
               me->defend-=2;
                system("cls");
                break;

        }
        break;

    }
    system("cls");
   if(batt==1)
   {
       mapload();
    mapprint();
    printme(me);//设置打印地图,打印自己
   }
    enemymake();//设置敌人属性
    if(batt==1)
    {

    enemyplace();//放置第一关并打印敌人
    enemyprint();
    }
    int ii=0;
    if(batt>=2)ii=1;//置位第一次
    while(1)
    {
        if(batt==2&&ii==1)
        {
            enemymake();
            ii=0;
             printf("第%d关,地图加载中,请稍等",batt);
             Sleep(4000);
             system("cls");
             printf("魔王:哈哈,不错嘛,能来到本关\n");
             Sleep(2000);
             printf("你的绝望会让你痛不欲生......哈哈哈哈\n");
             printf("(按任意键继续)");//剧情设置
             getch();
             system("cls");
             printf("获得圣神祝福\n");
             me->attack+=100;
             me->defend+=50;
             me->health+=5000;
             Sleep(2000);
             printf("按任意键继续");
             getch();
             system("cls");
             printf("嘻嘻,帅帅的豪哥又来送福利了\n");
          printf("(按任意键继续)");
          getch();
         system("cls");
         printf("是否膜拜制作人豪哥?膜拜有奖哦\n");
          printf("1.膜拜 2.不膜拜 3.仍一个粑粑给制作人");
        ac=getch();
       switch(ac)
      {
        case '1':
          system("cls");
          printf("恭喜你获得buff攻击加20,生命加1500\n");
          printf("按任意键继续");
          getch();
          me->attack+=20;
          me->health+=1500;
          system("cls");
        break;
       case '2':
          system("cls");
          printf("豪哥甩了一张瓜皮脸给你,并向你的排位扔了4个小学生\n");
          printf("按任意键继续");
          getch();
          system("cls");
          break;
       case '3':
          system("cls");
          printf("豪哥非常不开心,但是大度的豪哥给你一个选择的机会\n");
          printf("1.豪哥太帅了 2.丑比");
          ac=getch();
        switch(ac)
        {
           case '1':
               system("cls");
                printf("可以,可以,豪哥奖励你防御10点,生命1000点\n");
                printf("按任意键继续");
                getch();
                system("cls");
                me->defend+=10;
                me->health+=1000;
                break;
           case '2':
               system("cls");
               printf("你惹豪哥生气了,豪哥要施罚于你\n");
               printf("你的攻击减少10点,你的防御减少10点\n");
               printf("按任意键继续");
               getch();
               me->attack-=10;
               me->defend-=10;
                system("cls");
                break;

        }
        break;

    }
    system("cls");
             Sleep(3000);
              mapload();
               mapprint();//设置地图
               if(batt==2)
               {
                   sword.x=FrameX+6;
                   sword.y=FrameY+Frame_height-8;
                   shield.x=FrameX+6;
                   shield.y=FrameY+Frame_height-10;
                   Gotoxy(FrameX+6,FrameY+Frame_height-8);
                   printf("→");
                    Gotoxy(FrameX+6,FrameY+Frame_height-10);
                    printf("】");
               }//设置第二关圣剑圣盾属性
                me->x=FrameX+2;
                me->y=FrameY+Frame_height-1;
                 enemyplace();
                enemyprint();
               printme(me);//设置第二关的敌人与我

        }
        else if(batt>=3&&ii==1&&cs==1)
        {
            printf("豪哥又来了!!!!!\n");
    printf("(按任意键继续)");
    getch();
    system("cls");
    printf("是否膜拜制作人豪哥?膜拜有奖哦\n");
    printf("1.膜拜 2.不膜拜 3.仍一个粑粑给制作人");
     ac=getch();
    switch(ac)
    {
     case '1':
        system("cls");
        printf("恭喜你获得buff攻击加30,生命加2000\n");
        printf("按任意键继续");
        getch();
        me->attack+=30;
        me->health+=2000;
        system("cls");
        break;
     case '2':
        system("cls");
        printf("豪哥甩了一张瓜皮脸给你,并向你的排位扔了4个小学生\n");
        printf("按任意键继续");
        getch();
        system("cls");
        break;
     case '3':
        system("cls");
        printf("豪哥非常不开心,但是大度的豪哥给你一个选择的机会\n");
        printf("1.豪哥太帅了 2.丑比");
        ac=getch();
        switch(ac)
        {
           case '1':
               system("cls");
                printf("可以,可以,豪哥奖励你防御20点,生命1500点\n");
                printf("按任意键继续");
                getch();
                system("cls");
                me->defend+=20;
                me->health+=1500;
                break;
           case '2':
               system("cls");
               printf("你惹豪哥生气了,豪哥要施罚于你\n");
               printf("你的攻击减少20点,你的防御减少20点\n");
               printf("按任意键继续");
               getch();
               me->attack-=20;
               me->defend-=20;
                system("cls");
                break;

        }
        break;

    }
    system("cls");
              enemymake();
            ii=0;
             printf("第%d关第%d层,地图加载中,请稍等",batt,cs);
             Sleep(4000);
             system("cls");
             printf("感受炼狱般的恐怖吧");
             printf("(按任意键继续)");//剧情设置
             getch();
             system("cls");
              mapload();
               mapprint();//加载地图

                  me->x=FrameX+2;
                me->y=FrameY+Frame_height-2;//设置我自己

                printme(me);//打印我自己

            msword.x=FrameX+24;
            msword.y=FrameY+Frame_height-7;//设置银剑
            Gotoxy(FrameX+24,FrameY+Frame_height-7);
            printf("╃");//打印银剑
            mshield.x=FrameX+28;
            mshield.y=FrameY+Frame_height-7;//设置圣盾
            Gotoxy(FrameX+28,FrameY+Frame_height-7);
            printf("@");//打印圣盾
            sword.x=FrameX+52;
            sword.y=FrameY+Frame_height-11;
            shield.x=FrameX+56;
            shield.y=FrameY+Frame_height-11;
            Gotoxy(FrameX+52,FrameY+Frame_height-11);
            printf("→");
            Gotoxy(FrameX+56,FrameY+Frame_height-11);
            printf("】");//在第三关重新设置并打印圣剑圣盾
            enemyplace();
            enemyprint();
            atplace();
            atprint();//第三关敌人与道具设置
                         }


         else if(batt==3&&ii==1&&cs==2)
         {
             printf("欢迎来到中秋特别版,本版本福利多多哦\n");
    printf("(按任意键继续)");
    getch();
    system("cls");
    printf("想打败魔王幻影吗,想就膜拜宝宝我阿!嘻嘻\n");
    printf("1.膜拜 2.不膜拜 3.仍一个粑粑给制作人");
     ac=getch();
    switch(ac)
    {
     case '1':
        system("cls");
        printf("恭喜你获得buff攻击加100,生命加5000\n");
        printf("按任意键继续");
        getch();
        me->attack+=5;
        me->health+=500;
        system("cls");
        break;
     case '2':
        system("cls");
        printf("豪哥甩了一张瓜皮脸给你,并向你的排位扔了4个小学生\n");
        printf("按任意键继续");
        getch();
        system("cls");
        break;
     case '3':
        system("cls");
        printf("豪哥非常不开心,但是大度的豪哥给你一个选择的机会\n");
        printf("1.豪哥太帅了 2.丑比");
        ac=getch();
        switch(ac)
        {
           case '1':
               system("cls");
                printf("可以,可以,豪哥奖励你防御60点,生命3000点\n");
                printf("按任意键继续");
                getch();
                system("cls");
                me->defend+=60;
                me->health+=3000;
                break;
           case '2':
               system("cls");
               printf("你惹豪哥生气了,豪哥要施罚于你\n");
               printf("你的攻击减少40点,你的防御减少40点\n");
               printf("按任意键继续");
               getch();
               me->attack-=40;
               me->defend-=40;
                system("cls");
                break;

        }
        break;

    }
    system("cls");
            for(int i=0;i<=10;++i)
            {
               for(int j=0;j<=30;++j)

               {
                  enemy[i][j].x=150;
                  enemy[i][j].y=150;
               }

           }//第三关第二层先初始化敌人
      for(int i=0;i<50;++i)
      {
        ddi[i].x=150;
        ddi[i].y=150;
         adi[i].x=150;
        adi[i].y=150;
         hdi[i].x=150;
        hdi[i].y=150;
     }//讲宝石重置,防止
    sword.x=150;
    sword.y=150;
    shield.x=150;
    shield.y=150;
    msword.x=150;
    msword.y=150;
    mshield.x=150;
    mshield.y=150;
    godsword.x=FrameX+14;
    godsword.y=FrameY+2;
    godshield.x=FrameX+18;
    godshield.y=FrameY+2;
        printf("第%d关第%d层,地图加载中,请稍等",batt,cs);
             Sleep(4000);
             system("cls");
             ii=0;
             printf("让我来好好教训一下你吧,哈哈哈哈\n");
            printf("(按任意键继续)");
            getch();
            system("cls");
              mapload();
               mapprint();
               me->x=FrameX+2;
                me->y=FrameY+Frame_height-2;
                  enemymake();
                  enemyplace();
                enemyprint();
                Gotoxy(godsword.x,godsword.y);
                printf("┞");
                Gotoxy(godshield.x,godshield.y);
                printf("&");
                atplace();
                atprint();
                printme(me);

        }
        else if(batt==3&&ii==1&&cs==3)
        {
             printf("第%d关第%d层,地图加载中,请稍等",batt,cs);
             Sleep(4000);
             system("cls");
             printf("一决高下吧!!!!!!\n");
             printf("(按任意键继续)");
             getch();
             system("cls");
             printf("受到大锐哥(魔王)的诅咒\n");
             Sleep(2000);
             printf("(按任意键继续)");
             getch();
             system("cls");
             ii=0;
              mapload();
               mapprint();
                me->x=FrameX+2;
                me->y=FrameY+Frame_height-2;
                 enemymake();
                      enemyplace();
                enemyprint();
                printme(me);
                me->health-=5000;
                Gotoxy(FrameX+2,FrameY+8);
                printf("\3");
                map[FrameY+8][FrameX+4]=2;
                map[FrameY+7][FrameX+4]=4;
                map[FrameY+9][FrameX+4]=6;
                map[FrameY+7][FrameX+2]=1;
                map[FrameY+9][FrameX+2]=1;
                map[FrameY+7][FrameX]=3;
                map[FrameY+9][FrameX]=5;
                mapprint();
                Gotoxy(FrameX+2*Frame_width,FrameY);
                printf("圣神已被我摧毁,心已被我封印,哈哈哈哈,现在没人能帮你了");
                Sleep(4000);
                 Gotoxy(FrameX+2*Frame_width,FrameY);
                  printf("                                                                     ");


        }
    moveme(me);
    if(batt==3&&cs==2)
    {
        int lll=0;
        int ll=0;
        for(int i=5;i<=8;++i)
            for(int j=0;j<20;++j)
        {
            if(enemy[i][j].x==150)lll++;
        }
        if(lll==80)map[FrameY+Frame_height-8][FrameX+8]=0;
        if(enemy[9][0].x==150&&enemy[9][1].x==150&&enemy[9][2].x==150)map[FrameY+4][FrameX+16]=0;
    }
    if(batt==3&&cs==3&&ii==0&&ak==0)
    {
        if(enemy[10][0].x==150&&enemy[10][1].x==150)
        {

            map[FrameY+8][FrameX+4]=0;
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("圣神:我的心永远存在");
        Sleep(3000);
        Gotoxy(FrameX+Frame_width*2,FrameY+1);
        printf("圣神:用你的意念破除诅咒,获得我心灵的力量与你一同战斗吧");
        Sleep(3000);
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("                                         ");
         Gotoxy(FrameX+Frame_width*2,FrameY+1);
         printf("                                                                           ");
         ak=1;
        }

    }
    if(me->x==sword.x&&me->y==sword.y)
    {
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("你已获得圣剑");
        Sleep(1000);
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("              ");
        me->attack*=2;
        sword.x=150;
        sword.y=150;
    }
     else if(me->x==shield.x&&me->y==shield.y)
    {
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("你已获得圣盾");
        Sleep(1000);
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("              ");
        me->defend*=2;
        shield.x=150;
        shield.y=150;
    }
    else if(me->x==msword.x&&me->y==msword.y)
    {
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("你已获得银剑");
        Sleep(1000);
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("              ");
        me->attack+=50;
        msword.x=150;
        msword.y=150;
    }
    else if(me->x==mshield.x&&me->y==mshield.y)
    {
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("你已获得银盾");
        Sleep(1000);
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("              ");
        me->defend+=50;
        mshield.x=150;
        mshield.y=150;
    }
    else if(me->x==godsword.x&&me->y==godsword.y)
    {
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("你已获得神圣之剑");
        Sleep(1000);
         Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("                     ");
        me->attack+=800;
        godsword.x=150;
        godsword.y=150;
    }
     else if(me->x==godshield.x&&me->y==godshield.y)
    {
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("你已获得神圣之盾");
        Sleep(1000);
         Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("                     ");
        me->defend+=500;
        godshield.x=150;
        godshield.y=150;
    }

    for(int i=0;i<50;++i)
    {
        if(me->x==adi[i].x&&me->y==adi[i].y)
        {
            Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("获得攻击宝石,攻击力增加5");
        Sleep(1000);
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("                                 ");
        adi[i].x=150;
        adi[i].y=150;
        me->attack+=5;
        }
        else if(me->x==ddi[i].x&&me->y==ddi[i].y)
        {
            Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("获得防御宝石,防御力增加5");
        Sleep(1000);
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("                                 ");
        ddi[i].x=150;
        ddi[i].y=150;
        me->defend+=5;
        }
      else if(me->x==hdi[i].x&&me->y==hdi[i].y)
        {
            Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("获得生命药水,生命上升1000");
        Sleep(1000);
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("                                ");
        hdi[i].x=150;
        hdi[i].y=150;
        me->health+=1000;
        }
    }

    for(int i=0;i<=10;++i)
    for(int j=0;j<=30;++j)
    {
        if(me->x==enemy[i][j].x&&me->y==enemy[i][j].y)
        {
            while(me->health!=0||enemy[i][j].health!=0)
            {

                Sleep(20);
                printme(me);
                Sleep(20);
                Gotoxy(me->x,me->y);
                printf(" ");
                battlesite(me,i,j);
                battle(me,i,j);
                Sleep(500);
                if(enemy[i][j].health<=0)
                {
                    Gotoxy(me->x,me->y);
                    printf("★");
                    for(int k=1;k<=16;++k)
                    {
                    Gotoxy(FrameX+Frame_width*2,FrameY+k-1);
                    printf("                                                                    ");
                    }
                    enemy[i][j].x=150;
                    enemy[i][j].y=150;
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("战斗胜利");
                    Sleep(1000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("          ");
                    int kick;
                  if(i==0)
                  {
                      kick=10;
                      Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("获得金币%d",kick);
                    Sleep(1000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("               ");

                  }
                  else if(i==1)
                  {
                       kick=20;
                      Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("获得金币%d",kick);
                    Sleep(1000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("                 ");
                  }
                  else if(i==2)
                  {
                       kick=25;
                      Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("获得金币%d",kick);
                    Sleep(1000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("                  ");
                  }
                  else if(i==3)
                  {
                       kick=15;
                      Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("获得金币%d",kick);
                    Sleep(1000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("                ");
                  }
                 else if(i==4)
                  {
                       kick=30;
                      Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("获得金币%d",kick);
                    Sleep(1000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("                ");
                  }
                  else if(i==5)
                  {
                       kick=45;
                      Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("获得金币%d",kick);
                    Sleep(1000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("                ");
                  }
                  else if(i==6)
                  {
                       kick=60;
                      Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("获得金币%d",kick);
                    Sleep(1000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("              ");
                  }
                  else if(i==7)
                  {
                       kick=100;
                      Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("获得金币%d",kick);
                    Sleep(1000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("               ");
                  }
                  else if(i==8)
                  {
                       kick=130;
                      Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("获得金币%d",kick);
                    Sleep(1000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("                ");
                  }
                  else if(i==9)
                  {
                       kick=150;
                      Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("获得金币%d",kick);
                    Sleep(1000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("               ");
                  }
                  else if(i==10)
                  {
                       kick=200;
                      Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("获得金币%d",kick);
                    Sleep(1000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("                ");
                  }
                  money+=kick;

                    break;
                }
                else if(me->health<=0)
                {
                     for(int k=1;k<=16;++k)
                    {
                    Gotoxy(FrameX+Frame_width*2,FrameY+k-1);
                    printf("                                                                    ");
                    }
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("你死了");
                    Sleep(2000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("         ");
                    Sleep(2000);
                    Gotoxy(FrameX+Frame_width*2,FrameY);
                    printf("游戏结束");
                    Sleep(4000);
                    isdie=1;
                    break;
                }
                else if(me->attack<=enemy[i][j].defend&&me->defend>=enemy[i][j].attack)
                {
                    break;
                }

            }
        }
    }
    int ol=0;
    int flag=0;
    for(int i=0;i<=10;++i)
    {
    for(int j=0;j<=30;++j)
    {
        if(enemy[i][j].x!=150)
        {
            flag=1;
            break;
        }
        ol++;
    }
      if(flag==1)break;
    }
    if(ol==341&&batt<=2)
    {
        Sleep(2000);
        Gotoxy(FrameX+Frame_width*2,FrameY);
        printf("您已通过第%d关",batt);
        Sleep(2000);
        system("cls");
        batt++;
        ii=1;
    }
    if(me->x==FrameX+2*Frame_width-4&&me->y==FrameY+1&&batt==3)
    {
        cs++;
         system("cls");
        ii=1;
    }
    else if(batt==3&&cs==3&&enemy[10][0].x==150&&enemy[10][1].x==150&&enemy[10][2].x==150)
    {
         Gotoxy(FrameX+Frame_width*2,FrameY);
         printf("您已通过所有关卡");
         Sleep(4000);
         system("cls");
         victory();
         break;
    }
      else if(batt==3&&cs==3&&ac1==0)
    {
         if(me->x==FrameX+2&&me->y==FrameY+8)
         {
             me->health+=12000;
         ac1=1;
         Gotoxy(FrameX+2*Frame_width,FrameY);
         printf("圣神:你已领悟真谛,去战胜魔王结束这一切吧!!!");
         Sleep(4000);
         Gotoxy(FrameX+2*Frame_width,FrameY);
         printf("                                                                          ");
         }
    }
    if(isdie==1)
    {
        system("cls");
        overgame();
        Sleep(6000);
        break;
    }

}
 s=getch();
 while(1);
    return 0;
}
void Hide()
{
    HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO info={1,0};
    SetConsoleCursorInfo(hout,&info);
}//隐藏光标
void Gotoxy(int x,int y)
{

    HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
    COORD pos;
    pos.X=x;
    pos.Y=y;
    SetConsoleCursorPosition(hOut,pos);
}//光标跳转
void MainMenu()
{
    unsigned char ch;
   printf("\n\n\n\n\n\n");
   printf("\t ________________________________________________________________\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                              叱咤风云                                                                    |\n");
   printf("\t|                                        按任意键开始游戏                                                           |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|________________________________________________________________|\n");
  getch();

}//打印一个矩形框
void setWindowsSize(int w,int h)
{
    HANDLE hout;
    hout=GetStdHandle(STD_OUTPUT_HANDLE);
    SMALL_RECT rc={0,0,w-1,h-1};
    COORD size = {w,h};
    SetConsoleWindowInfo(hout,TRUE,&rc);
    SetConsoleScreenBufferSize(hout,size);
}//设置矩形界面大小
void moveme(struct attribute *me)
{
    char ch;
    ch=getch();
       switch(ch)
   {
       case 72:
           Gotoxy(me->x,me->y);
           printf(" ");
           if(me->y>FrameY+1&&map[me->y-1][me->x]==0)me->y-=1;
           printme(me);
       break;
       case 80:
           Gotoxy(me->x,me->y);
           printf(" ");
          if(me->yy+1][me->x]==0) me->y+=1;
            printme(me);
       break;
       case 75:
           Gotoxy(me->x,me->y);
           printf(" ");
           if((me->x>FrameX+2&&map[me->y][me->x-2]==0)||(batt==2&&me->x==FrameX+16&&me->y==FrameY+Frame_height-6)||(batt==2&&me->x==FrameX+12&&me->y==FrameY+Frame_height-10))me->x-=2;
            printme(me);
       break;
       case 77:
           Gotoxy(me->x,me->y);
           printf(" ");
           if((batt==3&&me->x==FrameX+46&&me->y==FrameY+Frame_height-8)||(me->xy][me->x+2]==0)||(batt==2&&me->x==FrameX+12&&me->y==FrameY+Frame_height-6)||(batt==2&&me->x==FrameX+8&&me->y==FrameY+Frame_height-10)||(batt==3&&me->x==FrameX+20&&me->y==FrameY+Frame_height-8)||(batt==3&&me->x==FrameX+28&&me->y==FrameY+Frame_height-8))
                me->x+=2;
            printme(me);
            break;
       case 'a':case 'A':
        attributeprint(me);
       break;
       case 's':case 'S':
        Gotoxy(FrameX+Frame_width*2,FrameY+16);
        printf("                                                                 ");
    Gotoxy(FrameX+Frame_width*2,FrameY+17);
     printf("                                                                 ");
    Gotoxy(FrameX+Frame_width*2,FrameY+18);
      printf("                                                                 ");
    Gotoxy(FrameX+Frame_width*2,FrameY+19);
    printf("                                                                 ");
    Gotoxy(FrameX+Frame_width*2,FrameY+20);
   printf("                                                                 ");
    Gotoxy(FrameX+Frame_width*2,FrameY+21);
     printf("                                                                 ");
    Gotoxy(FrameX+Frame_width*2,FrameY+22);
    printf("                                                                 ");
    Gotoxy(FrameX+Frame_width*2,FrameY+23);
     printf("                                                                 ");
     break;
       case 'd':case 'D':
        if(batt==2)
        {
            Gotoxy(FrameX+Frame_width*2,FrameY+16);
            printf("提示:想通过本关,请务必拿到圣剑和圣盾");
            Sleep(2000);
            Gotoxy(FrameX+Frame_width*2,FrameY+17);
            printf("提示:穿墙");
        }
        else if(batt==3&&cs==1)
        {
            Gotoxy(FrameX+Frame_width*2,FrameY+16);
            printf("提示:想通过本层,并对下几层有帮助,");
            Sleep(2000);
            Gotoxy(FrameX+Frame_width*2,FrameY+17);
            printf("请务必拿到各种宝石,银剑银盾后再拿圣剑圣盾");
            Gotoxy(FrameX+Frame_width*2,FrameY+18);
            printf("提示:穿墙");
        }
        else if(batt==3&&cs==2)
        {
             Gotoxy(FrameX+Frame_width*2,FrameY+16);
            printf("提示:想打败下层的魔王大锐哥,");
            Gotoxy(FrameX+Frame_width*2,FrameY+17);
            printf("请务必拿到神圣之剑和神圣之盾");
            Sleep(2000);
            Gotoxy(FrameX+Frame_width*2,FrameY+18);
            printf("提示:击败魔王幻影");
        }
        else if(batt==3&&cs==3)
        {
            Gotoxy(FrameX+Frame_width*2,FrameY+16);
            printf("提示:击败魔王大锐哥以及两个护法后即可通关");
        }
        break;
       case 'f':case 'F':
         Gotoxy(FrameX+Frame_width*2,FrameY+16);
         printf("欢迎来到商店:请选择你要提升的属性:");
         Gotoxy(FrameX+Frame_width*2,FrameY+17);
         printf("1:攻击加1点(20金币)");
         Gotoxy(FrameX+Frame_width*2,FrameY+18);
         printf("2:防御加1点(20金币)");
         Gotoxy(FrameX+Frame_width*2,FrameY+19);
         printf("3:血量加200点(20金币)");
         Gotoxy(FrameX+Frame_width*2,FrameY+20);
         printf("4:以上三个均提升一次(50金币)");
         flag=1;
         break;
       case '1':
        if(flag==1&&money>=20)
        {
            me->attack+=1;
            money-=20;
            flag=0;
        }
        else if(flag==1&&money<20)
        {
            Gotoxy(FrameX+Frame_width*2,FrameY+21);
            printf("金钱不足");
            Sleep(2000);
             Gotoxy(FrameX+Frame_width*2,FrameY+21);
            printf("           ");
        }
        Gotoxy(FrameX+Frame_width*2,FrameY+16);
         printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+17);
         printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+18);
         printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+19);
        printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+20);
       printf("                                          ");
        break;
         case '2':
        if(flag==1&&money>=20)
        {
            me->defend+=1;
            money-=20;
            flag=0;
        }
          else if(flag==1&&money<20)
        {
            Gotoxy(FrameX+Frame_width*2,FrameY+21);
            printf("金钱不足");
            Sleep(2000);
             Gotoxy(FrameX+Frame_width*2,FrameY+21);
            printf("           ");
        }
         Gotoxy(FrameX+Frame_width*2,FrameY+16);
         printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+17);
         printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+18);
         printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+19);
        printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+20);
       printf("                                          ");
        break;
         case '3':
        if(flag==1&&money>=20)
        {
            me->health+=200;
            money-=20;
            flag=0;
        }
          else if(flag==1&&money<20)
        {
            Gotoxy(FrameX+Frame_width*2,FrameY+21);
            printf("金钱不足");
            Sleep(2000);
             Gotoxy(FrameX+Frame_width*2,FrameY+21);
            printf("           ");
        }
         Gotoxy(FrameX+Frame_width*2,FrameY+16);
         printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+17);
         printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+18);
         printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+19);
        printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+20);
       printf("                                          ");
        break;
         case '4':
        if(flag==1&&money>=50)
        {
            me->attack+=1;
            me->health+=200;
            me->defend+=1;
            money-=50;
            flag=0;
        }
          else if(flag==1&&money<50)
        {
            Gotoxy(FrameX+Frame_width*2,FrameY+21);
            printf("金钱不足");
            Sleep(2000);
             Gotoxy(FrameX+Frame_width*2,FrameY+21);
            printf("           ");
        }
         Gotoxy(FrameX+Frame_width*2,FrameY+16);
         printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+17);
         printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+18);
         printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+19);
        printf("                                          ");
         Gotoxy(FrameX+Frame_width*2,FrameY+20);
       printf("                                          ");
        break;
        case 'g':case'G':
        Gotoxy(FrameX+Frame_width*2,FrameY+16);
        printf("当前金钱是%d",money);
        break;
        case '*':
            me->health+=10000;
        break;
        case '+':me->attack+=100;
        break;
        case '-':me->defend+=100;
        break;

   }
}
void printme(struct attribute *me)
{
    Gotoxy(me->x,me->y);
     printf("★");
}
void enemymake()
{
    for(int j=0;j<=30;++j)
    {
       strcpy(enemy[0][j].name,"青头怪");
       enemy[0][j].health=100;
       enemy[0][j].attack=15;
       enemy[0][j].defend=10;
       enemy[0][j].x=150;
       enemy[0][j].y=150;
    }
    for(int j=0;j<=30;++j)
    {
        strcpy(enemy[1][j].name,"骷髅人");
        enemy[1][j].health=150;
        enemy[1][j].attack=40;
        enemy[1][j].defend=12;
        enemy[1][j].x=150;
       enemy[1][j].y=150;
    }
    for(int j=0;j<=30;++j)
    {
        strcpy(enemy[2][j].name,"骷髅士兵");
        enemy[2][j].health=300;
        enemy[2][j].attack=70;
        enemy[2][j].defend=15;
        enemy[2][j].x=150;
       enemy[2][j].y=150;
    }
    for(int j=0;j<=30;++j)
    {
        strcpy(enemy[3][j].name,"小蝙蝠");
        enemy[3][j].health=120;
        enemy[3][j].attack=60;
        enemy[3][j].defend=12;
        enemy[3][j].x=150;
       enemy[3][j].y=150;
    }
    for(int j=0;j<=30;++j)
    {
        strcpy(enemy[4][j].name,"大蝙蝠");
        enemy[4][j].health=350;
        enemy[4][j].attack=100;
        enemy[4][j].defend=24;
        enemy[4][j].x=150;
       enemy[4][j].y=150;
    }
     for(int j=0;j<=30;++j)
    {
        strcpy(enemy[5][j].name,"骷髅队长");
        enemy[5][j].health=500;
        enemy[5][j].attack=120;
        enemy[5][j].defend=30;
        enemy[5][j].x=150;
       enemy[5][j].y=150;
    }
     for(int j=0;j<=30;++j)
    {
        strcpy(enemy[6][j].name,"初级卫兵");
        enemy[6][j].health=1500;
        enemy[6][j].attack=100;
        enemy[6][j].defend=50;
        enemy[6][j].x=150;
       enemy[6][j].y=150;
    }
      for(int j=0;j<=30;++j)
    {
        strcpy(enemy[7][j].name,"冥卫兵");
        enemy[7][j].health=1400;
        enemy[7][j].attack=150;
        enemy[7][j].defend=80;
        enemy[7][j].x=150;
       enemy[7][j].y=150;
    }
      for(int j=0;j<=30;++j)
    {
        strcpy(enemy[8][j].name,"白衣武士");
        enemy[8][j].health=2000;
        enemy[8][j].attack=200;
        enemy[8][j].defend=100;
        enemy[8][j].x=150;
       enemy[8][j].y=150;
    }
      for(int j=0;j<=30;++j)
    {
        strcpy(enemy[9][j].name,"金队长");
        enemy[9][j].health=3000;
        enemy[9][j].attack=300;
        enemy[9][j].defend=120;
        enemy[9][j].x=150;
       enemy[9][j].y=150;
    }
    for(int j=0;j<=30;++j)
    {
        strcpy(enemy[10][j].name,"魔王(幻影)");
        enemy[10][j].health=8000;
        enemy[10][j].attack=1500;
        enemy[10][j].defend=500;
        enemy[10][j].x=150;
       enemy[10][j].y=150;
    }

}
void enemyprint()
{
  for(int i=0;i<=10;++i)
  {
      for(int j=0;j<=30;++j)
      {
          if(enemy[i][j].x!=150)
          {
              Gotoxy(enemy[i][j].x,enemy[i][j].y);
              if(!strcmp(enemy[i][j].name,"青头怪"))printf("\1");
              else if(!strcmp(enemy[i][j].name,"骷髅人"))printf("€");
              else if(!strcmp(enemy[i][j].name,"骷髅士兵"))printf("※");
              else if(!strcmp(enemy[i][j].name,"小蝙蝠"))printf("¤");
              else if(!strcmp(enemy[i][j].name,"大蝙蝠"))printf("┳");
              else if(!strcmp(enemy[i][j].name,"骷髅队长"))printf("◎");
              else if(!strcmp(enemy[i][j].name,"初级卫兵"))printf("○");
              else if(!strcmp(enemy[i][j].name,"冥卫兵"))printf("●");
              else if(!strcmp(enemy[i][j].name,"白衣武士"))printf("↑");
              else if(!strcmp(enemy[i][j].name,"金队长"))printf("\2");
              else if(!strcmp(enemy[i][j].name,"魔王(幻影)"))printf("◇");
              else if(!strcmp(enemy[i][j].name,"飞哥左护法"))printf("№");
              else if(!strcmp(enemy[i][j].name,"伟哥右护法"))printf("☆");
              else if(!strcmp(enemy[i][j].name,"大锐哥"))printf("◆");
          }
      }
  }

}
void enemyplace()
{
   if(batt==1)
   {
       enemy[0][0].x=FrameX+2;
       enemy[0][0].y=FrameY+Frame_height-2;
       enemy[0][1].x=FrameX+2;
       enemy[0][1].y=FrameY+Frame_height-5;
       enemy[0][2].x=FrameX+4;
       enemy[0][2].y=FrameY+Frame_height-6;
       enemy[0][3].x=FrameX+8;
       enemy[0][3].y=FrameY+Frame_height-6;
       enemy[0][4].x=FrameX+16;
       enemy[0][4].y=FrameY+Frame_height-6;
       /*enemy[0][5].x=FrameX+20;
       enemy[0][5].y=FrameY+Frame_height-9;*/
       enemy[0][5].x=FrameX+20;
       enemy[0][5].y=FrameY+Frame_height-9;
       enemy[0][6].x=FrameX+22;
       enemy[0][6].y=FrameY+Frame_height-10;
       enemy[0][7].x=FrameX+12;
       enemy[0][7].y=FrameY+Frame_height-13;
       enemy[0][8].x=FrameX+6;
       enemy[0][8].y=FrameY+Frame_height-13;
       enemy[0][9].x=FrameX+2;
       enemy[0][9].y=FrameY+Frame_height-13;
       enemy[0][10].x=FrameX+2;
       enemy[0][10].y=FrameY+Frame_height-16;
       enemy[0][11].x=FrameX+2;
       enemy[0][11].y=FrameY+Frame_height-18;
       enemy[0][12].x=FrameX+6;
       enemy[0][12].y=FrameY+Frame_height-19;
       enemy[0][13].x=FrameX+12;
       enemy[0][13].y=FrameY+Frame_height-19;
       enemy[0][14].x=FrameX+34;
       enemy[0][14].y=FrameY+Frame_height-19;
       enemy[0][15].x=FrameX+34;
       enemy[0][15].y=FrameY+Frame_height-16;
       enemy[0][16].x=FrameX+34;
       enemy[0][16].y=FrameY+Frame_height-13;
       enemy[1][0].x=FrameX+20;
       enemy[1][0].y=FrameY+Frame_height-10;
       enemy[1][1].x=FrameX+22;
       enemy[1][1].y=FrameY+Frame_height-8;
       enemy[1][2].x=FrameX+22;
       enemy[1][2].y=FrameY+Frame_height-19;
       enemy[1][3].x=FrameX+34;
       enemy[1][3].y=FrameY+Frame_height-18;
       enemy[1][4].x=FrameX+34;
       enemy[1][4].y=FrameY+Frame_height-8;
       enemy[1][5].x=FrameX+34;
       enemy[1][5].y=FrameY+Frame_height-4;
       enemy[1][6].x=FrameX+40;
       enemy[1][6].y=FrameY+Frame_height-4;
       enemy[1][7].x=FrameX+44;
       enemy[1][7].y=FrameY+Frame_height-5;
       enemy[2][0].x=FrameX+44;
       enemy[2][0].y=FrameY+Frame_height-20;
   }
   else if(batt==2)
   {

     enemy[1][8].x=FrameX+2;
     enemy[1][8].y=FrameY+Frame_height-4;
     enemy[1][9].x=FrameX+2;
     enemy[1][9].y=FrameY+Frame_height-5;
     enemy[1][10].x=FrameX+2;
     enemy[1][10].y=FrameY+Frame_height-8;
     enemy[1][11].x=FrameX+2;
     enemy[1][11].y=FrameY+Frame_height-11;
     enemy[1][12].x=FrameX+2;
     enemy[1][12].y=FrameY+Frame_height-13;

     enemy[2][0].x=FrameX+6;
     enemy[2][0].y=FrameY+Frame_height-13;
     enemy[2][1].x=FrameX+8;
     enemy[2][1].y=FrameY+Frame_height-15;
     enemy[2][2].x=FrameX+8;
     enemy[2][2].y=FrameY+Frame_height-18;
     enemy[2][3].x=FrameX+8;
     enemy[2][3].y=FrameY+Frame_height-20;
     enemy[2][4].x=FrameX+8;
     enemy[2][4].y=FrameY+Frame_height-22;

     enemy[3][0].x=FrameX+14;
     enemy[3][0].y=FrameY+2;
     enemy[3][1].x=FrameX+14;
     enemy[3][1].y=FrameY+Frame_height-18;
     enemy[3][2].x=FrameX+14;
     enemy[3][2].y=FrameY+Frame_height-16;
     enemy[3][3].x=FrameX+14;
     enemy[3][3].y=FrameY+Frame_height-14;
     enemy[3][4].x=FrameX+18;
     enemy[3][4].y=FrameY+Frame_height-22;
      enemy[3][5].x=FrameX+18;
     enemy[3][5].y=FrameY+Frame_height-20;
     enemy[3][6].x=FrameX+16;
     enemy[3][6].y=FrameY+Frame_height-13;

     enemy[4][0].x=FrameX+20;
     enemy[4][0].y=FrameY+Frame_height-13;
     enemy[4][1].x=FrameX+24;
     enemy[4][1].y=FrameY+Frame_height-12;
     enemy[4][2].x=FrameX+24;
     enemy[4][2].y=FrameY+Frame_height-10;
      enemy[4][3].x=FrameX+22;
     enemy[4][3].y=FrameY+Frame_height-9;
      enemy[4][2].x=FrameX+20;
     enemy[4][2].y=FrameY+Frame_height-9;

     enemy[6][0].x=FrameX+16;
     enemy[6][0].y=FrameY+Frame_height-5;

     enemy[8][0].x=FrameX+32;
     enemy[8][0].y=FrameY+Frame_height-8;
     enemy[8][1].x=FrameX+32;
     enemy[8][1].y=FrameY+Frame_height-2;
     enemy[8][2].x=FrameX+34;
     enemy[8][2].y=FrameY+Frame_height-3;
     enemy[8][3].x=FrameX+34;
     enemy[8][3].y=FrameY+Frame_height-7;
     enemy[8][4].x=FrameX+36;
     enemy[8][4].y=FrameY+Frame_height-4;
      enemy[8][5].x=FrameX+36;
     enemy[8][5].y=FrameY+Frame_height-5;
      enemy[8][6].x=FrameX+36;
     enemy[8][6].y=FrameY+Frame_height-6;

     enemy[9][0].x=FrameX+32;
     enemy[9][0].y=FrameY+Frame_height-3;
     enemy[9][1].x=FrameX+32;
     enemy[9][1].y=FrameY+Frame_height-7;
       enemy[9][2].x=FrameX+34;
     enemy[9][2].y=FrameY+Frame_height-4;
      enemy[9][3].x=FrameX+34;
     enemy[9][3].y=FrameY+Frame_height-5;
     enemy[9][4].x=FrameX+34;
     enemy[9][4].y=FrameY+Frame_height-6;

   }
   else if(batt==3&&cs==1)
   {
      enemy[0][0].x=FrameX+2;
      enemy[0][0].y=FrameY+Frame_height-3;
      enemy[0][1].x=FrameX+2;
      enemy[0][1].y=FrameY+Frame_height-5;
      enemy[0][2].x=FrameX+2;
      enemy[0][2].y=FrameY+Frame_height-7;
      enemy[0][3].x=FrameX+6;
      enemy[0][3].y=FrameY+Frame_height-3;
       enemy[0][4].x=FrameX+10;
      enemy[0][4].y=FrameY+Frame_height-5;
       enemy[0][5].x=FrameX+16;
      enemy[0][5].y=FrameY+Frame_height-18;
      enemy[0][6].x=FrameX+16;
      enemy[0][6].y=FrameY+Frame_height-19;
      enemy[0][7].x=FrameX+16;
      enemy[0][7].y=FrameY+Frame_height-20;
      enemy[0][8].x=FrameX+16;
      enemy[0][8].y=FrameY+Frame_height-21;
      enemy[0][9].x=FrameX+16;
      enemy[0][9].y=FrameY+Frame_height-22;
      enemy[0][10].x=FrameX+24;
      enemy[0][10].y=FrameY+Frame_height-11;
      enemy[0][11].x=FrameX+26;
      enemy[0][11].y=FrameY+Frame_height-11;
      enemy[0][12].x=FrameX+28;
      enemy[0][12].y=FrameY+Frame_height-11;
      enemy[0][13].x=FrameX+28;
      enemy[0][13].y=FrameY+Frame_height-12;
      enemy[0][14].x=FrameX+28;
      enemy[0][14].y=FrameY+Frame_height-13;
        enemy[0][15].x=FrameX+30;
      enemy[0][15].y=FrameY+Frame_height-17;
      enemy[0][16].x=FrameX+28;
      enemy[0][16].y=FrameY+Frame_height-12;
        enemy[0][17].x=FrameX+50;
      enemy[0][17].y=FrameY+Frame_height-5;
        enemy[0][18].x=FrameX+52;
      enemy[0][18].y=FrameY+Frame_height-5;


      enemy[1][0].x=FrameX+8;
      enemy[1][0].y=FrameY+Frame_height-3;
      enemy[1][1].x=FrameX+34;
      enemy[1][1].y=FrameY+Frame_height-17;
       enemy[1][2].x=FrameX+50;
      enemy[1][2].y=FrameY+Frame_height-4;
        enemy[1][3].x=FrameX+52;
      enemy[1][3].y=FrameY+Frame_height-4;
        enemy[1][4].x=FrameX+54;
      enemy[1][4].y=FrameY+Frame_height-4;
        enemy[1][5].x=FrameX+56;
      enemy[1][5].y=FrameY+Frame_height-4;
       enemy[1][6].x=FrameX+54;
      enemy[1][6].y=FrameY+Frame_height-5;
        enemy[1][7].x=FrameX+56;
      enemy[1][7].y=FrameY+Frame_height-5;


      enemy[2][0].x=FrameX+10;
      enemy[2][0].y=FrameY+2;
      enemy[2][1].x=FrameX+48;
      enemy[2][1].y=FrameY+Frame_height-1;



      enemy[4][0].x=FrameX+44;
      enemy[4][0].y=FrameY+Frame_height-17;


      enemy[5][0].x=FrameX+10;
      enemy[5][0].y=FrameY+Frame_height-2;
      enemy[5][1].x=FrameX+12;
      enemy[5][1].y=FrameY+Frame_height-12;
      enemy[5][2].x=FrameX+14;
      enemy[5][2].y=FrameY+Frame_height-12;
      enemy[5][3].x=FrameX+16;
      enemy[5][3].y=FrameY+Frame_height-12;
      enemy[5][4].x=FrameX+28;
      enemy[5][4].y=FrameY+2;


      enemy[6][0].x=FrameX+18;
      enemy[6][0].y=FrameY+Frame_height-12;
      enemy[6][1].x=FrameX+36;
      enemy[6][1].y=FrameY+Frame_height-2;


      enemy[7][0].x=FrameX+10;
      enemy[7][0].y=FrameY+Frame_height-12;


      enemy[8][0].x=FrameX+8;
      enemy[8][0].y=FrameY+Frame_height-12;

   }
   else if(batt==3&&cs==2)
   {
       enemy[5][0].x=FrameX+2;
       enemy[5][0].y=FrameY+Frame_height-4;

        enemy[5][1].x=FrameX+4;
       enemy[5][1].y=FrameY+Frame_height-4;

        enemy[5][2].x=FrameX+6;
       enemy[5][2].y=FrameY+Frame_height-4;

        enemy[5][3].x=FrameX+8;
       enemy[5][3].y=FrameY+Frame_height-4;

          enemy[5][4].x=FrameX+8;
       enemy[5][4].y=FrameY+Frame_height-3;

          enemy[5][5].x=FrameX+8;
       enemy[5][5].y=FrameY+Frame_height-2;

          enemy[5][6].x=FrameX+8;
       enemy[5][6].y=FrameY+Frame_height-1;

       int i=0;

       for(int j=1;j<=5;++j)
       {
        enemy[6][i].x=FrameX+2*j;
        enemy[6][i].y=FrameY+Frame_height-5;
        i++;
       }
       for(int j=1;j<=4;j++)
       {

           enemy[6][i].x=FrameX+10;

           enemy[6][i].y=FrameY+Frame_height-5+j;

           i++;

       }

       i=0;

       for(int j=1;j<=6;++j)
       {

        enemy[7][i].x=FrameX+2*j;

        enemy[7][i].y=FrameY+Frame_height-6;

        i++;

       }
       for(int j=1;j<=5;++j)
       {

           enemy[7][i].x=FrameX+12;

           enemy[7][i].y=FrameY+Frame_height-6+j;

           i++;

       }
       i=0;
       for(int j=1;j<=7;++j)
       {

           enemy[8][i].x=FrameX+2*j;

           enemy[8][i].y=FrameY+Frame_height-7;

           i++;

       }
       for(int j=1;j<=6;++j)
       {

           enemy[8][i].x=FrameX+14;

           enemy[8][i].y=FrameY+Frame_height-7+j;

           i++;

       }
       enemy[9][0].x=FrameX+14;
       enemy[9][0].y=FrameY+Frame_height-20;

       enemy[9][1].x=FrameX+16;
       enemy[9][1].y=FrameY+Frame_height-20;

       enemy[9][2].x=FrameX+18;
       enemy[9][2].y=FrameY+Frame_height-20;

       enemy[10][0].x=FrameX+16;
       enemy[10][0].y=FrameY+Frame_height-22;

   }
   else if(batt==3&&cs==3)
   {

       strcpy(enemy[10][0].name,"飞哥");

       strcpy(enemy[10][1].name,"伟哥");

       strcpy(enemy[10][2].name,"大锐哥");

       enemy[10][0].attack=1500;
       enemy[10][0].defend=800;
       enemy[10][0].health=10000;

           enemy[10][1].attack=1500;
       enemy[10][1].defend=800;
       enemy[10][1].health=10000;

           enemy[10][2].attack=2500;
       enemy[10][2].defend=1000;
       enemy[10][2].health=20000;

       enemy[10][0].x=FrameX+18;
       enemy[10][0].y=FrameY+Frame_height-13;

       enemy[10][1].x=FrameX+22;
       enemy[10][1].y=FrameY+Frame_height-13;

         enemy[10][2].x=FrameX+20;
       enemy[10][2].y=FrameY+Frame_height-15;

   }
}
void battlesite(struct attribute *me,int i,int j)
{
    Gotoxy(FrameX+Frame_width*2,FrameY);
    printf("╔══════════════════╗");
    Gotoxy(FrameX+Frame_width*2,FrameY+1);
    printf("║英雄名字:%s      ",me->name);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+1);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+2);
    printf("║攻击力:%d        ",me->attack);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+2);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+3);
    printf("║防御力:%d         ",me->defend);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+3);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+4);
    printf("║生命值:%d         ",me->health);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+4);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+5);
    printf("║综合战力:%d       ",me->attack*6+me->defend*4);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+5);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+6);
    printf("║                  ");
    Gotoxy(FrameX+Frame_width*2+38,FrameY+6);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+7);
    printf("╚══════════════════\n\n");
    Gotoxy(FrameX+Frame_width*2+38,FrameY+7);
    printf("╝");



    Gotoxy(FrameX+Frame_width*2,FrameY+8);
    printf("╔══════════════════");
    Gotoxy(FrameX+Frame_width*2+38,FrameY+8);
    printf("╗");
    Gotoxy(FrameX+Frame_width*2,FrameY+9);
    printf("║怪物名字:%s      ",enemy[i][j].name);
     Gotoxy(FrameX+Frame_width*2+38,FrameY+9);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+10);
    printf("║攻击力:%d        ",enemy[i][j].attack);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+10);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+11);
    printf("║防御力:%d         ",enemy[i][j].defend);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+11);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+12);
    printf("║生命值:%d         ",enemy[i][j].health);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+12);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+13);
    printf("║综合战力:%d       ",enemy[i][j].attack*6+enemy[i][j].defend*4);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+13);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+14);
    printf("║                  ");
    Gotoxy(FrameX+Frame_width*2+38,FrameY+14);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+15);
    printf("╚══════════════════");
    Gotoxy(FrameX+Frame_width*2+38,FrameY+15);
    printf("╝");
}
void attributeprint(struct attribute *me)
{
    Gotoxy(FrameX+Frame_width*2,FrameY+16);
    printf("╔══════════════════╗");
    Gotoxy(FrameX+Frame_width*2,FrameY+17);
    printf("║英雄名字:%s      ",me->name);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+17);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+18);
    printf("║攻击力:%d        ",me->attack);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+18);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+19);
    printf("║防御力:%d         ",me->defend);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+19);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+20);
    printf("║生命值:%d         ",me->health);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+20);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+21);
    printf("║综合战力:%d       ",me->attack*6+me->defend*4);
    Gotoxy(FrameX+Frame_width*2+38,FrameY+21);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+22);
    printf("║                  ");
    Gotoxy(FrameX+Frame_width*2+38,FrameY+22);
    printf("║");
    Gotoxy(FrameX+Frame_width*2,FrameY+23);
    printf("╚══════════════════\n\n");
    Gotoxy(FrameX+Frame_width*2+38,FrameY+23);
    printf("╝");
}
void battle(struct attribute *me,int i,int j)
{
    if(me->attack>enemy[i][j].defend)enemy[i][j].health-=me->attack-enemy[i][j].defend;
    if(enemy[i][j].attack>me->defend)me->health-=enemy[i][j].attack-me->defend;
}
void overgame()
{
    system("cls");

     printf("\n\n\n\n\n\n");

   printf("\t ________________________________________________________________\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                          游  戏     结   束                                              |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|________________________________________________________________|\n");
}//结束界面
void victory()
{
    system("cls");

    printf("不!!!怎么会这样!!!\n");

    Sleep(2000);

    printf("在英雄的帮助下,世界重现和平\n");

    Sleep(2000);

    printf("按任意键继续");

    getch();

    system("cls");

     printf("\n\n\n\n\n\n");

   printf("\t ________________________________________________________________\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                            恭喜你,已经通过所有关卡                                         |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|                                                                                                                                |\n");
   printf("\t|________________________________________________________________|\n");
}//结束界面
void atplace()
{
    if(batt==3&&cs==1)
    {
        int j=0;
        for(int i=1;i<=9;++i)
        {
            adi[j].x=FrameX+2;
            adi[j].y=FrameY+Frame_height-8-i;
            j++;
        }
         for(int i=1;i<=9;++i)
        {
            adi[j].x=FrameX+4;
            adi[j].y=FrameY+Frame_height-8-i;
            j++;
        }
         for(int i=1;i<=9;++i)
        {
            adi[j].x=FrameX+6;
            adi[j].y=FrameY+Frame_height-8-i;
            j++;

        }
        adi[27].x=FrameX+12;
        adi[27].y=FrameY+Frame_height-13;
        adi[28].x=FrameX+14;
        adi[28].y=FrameY+Frame_height-13;
        adi[29].x=FrameX+16;
        adi[29].y=FrameY+Frame_height-13;
         adi[30].x=FrameX+32;
        adi[30].y=FrameY+Frame_height-1;
         adi[31].x=FrameX+34;
        adi[31].y=FrameY+Frame_height-1;
        adi[32].x=FrameX+46;
        adi[32].y=FrameY+Frame_height-18;
        adi[33].x=FrameX+48;
        adi[33].y=FrameY+Frame_height-18;
         adi[34].x=FrameX+12;
        adi[34].y=FrameY+Frame_height-24;
         adi[35].x=FrameX+24;
        adi[35].y=FrameY+Frame_height-24;

        hdi[0].x=FrameX+2;
        hdi[0].y=FrameY+Frame_height-18;
        hdi[1].x=FrameX+4;
        hdi[1].y=FrameY+Frame_height-18;
        hdi[2].x=FrameX+6;
        hdi[2].y=FrameY+Frame_height-18;
        hdi[3].x=FrameX+6;
        hdi[3].y=FrameY+Frame_height-2;
        hdi[4].x=FrameX+6;
        hdi[4].y=FrameY+Frame_height-4;
        hdi[5].x=FrameX+24;
        hdi[5].y=FrameY+Frame_height-1;
         hdi[6].x=FrameX+26;
        hdi[6].y=FrameY+Frame_height-1;
        hdi[7].x=FrameX+14;
        hdi[7].y=FrameY+1;
        hdi[8].x=FrameX+28;
        hdi[8].y=FrameY+1;
        hdi[9].x=FrameX+54;
        hdi[9].y=FrameY+Frame_height-18;
           hdi[10].x=FrameX+12;
        hdi[10].y=FrameY+Frame_height-1;

        ddi[0].x=FrameX+14;
        ddi[0].y=FrameY+Frame_height-1;
        ddi[1].x=FrameX+28;
        ddi[1].y=FrameY+Frame_height-1;
        ddi[2].x=FrameX+30;
        ddi[2].y=FrameY+Frame_height-1;
        ddi[3].x=FrameX+12;
        ddi[3].y=FrameY+Frame_height-11;
        ddi[4].x=FrameX+14;
        ddi[4].y=FrameY+Frame_height-11;
        ddi[5].x=FrameX+16;
        ddi[5].y=FrameY+Frame_height-11;
        ddi[6].x=FrameX+26;
        ddi[6].y=FrameY+1;
         ddi[7].x=FrameX+50;
        ddi[7].y=FrameY+Frame_height-18;
         ddi[8].x=FrameX+52;
        ddi[8].y=FrameY+Frame_height-18;

    }
}
//道具放置
void atprint()
{
    for(int i=0;i<50;++i)
    {
        if(ddi[i].x!=150)
        {
            Gotoxy(ddi[i].x,ddi[i].y);
            printf("♀");
        }
        if(adi[i].x!=150)
        {
            Gotoxy(adi[i].x,adi[i].y);
            printf("♂");
        }
        if(hdi[i].x!=150)
        {
            Gotoxy(hdi[i].x,hdi[i].y);
            printf("#");
        }
    }
}
//道具打印
void mapprint()
{
    for(int i=4;i<35;++i)
   {
       for(int j=4;j<=64;j+=2)
       {
           switch(map[i][j])
           {

               case 1:
                   Gotoxy(j,i);
                printf("═");
                break;
               case 3:
                   Gotoxy(j,i);
                printf("╔");
                break;
                case 4:
                    Gotoxy(j,i);
                printf("╗");
                break;
                case 5:
                    Gotoxy(j,i);
                printf("╚");
                break;
                case 6:
                    Gotoxy(j,i);
                printf("╝");
                break;
                case 2:
                    Gotoxy(j,i);
                    printf("║");
                    break;

           }
       }

   }
}
void mapload()
{
       FILE *fp;
    if(batt==1)fp=fopen("叱咤风云地图1.txt","r");
    else if(batt==2)fp=fopen("叱咤风云地图2.txt","r");
    else if(batt==3&&cs==1)
    {
        fp=fopen("叱咤风云地图3-1.txt","r");
    }
    else if(batt==3&&cs==2)
        fp=fopen("叱咤风云地图3-2.txt","r");
        else if(batt==3&&cs==3)
             fp=fopen("叱咤风云地图3-3.txt","r");
    char n;
    int i,j;
    i=j=0;
   while(1)
   {
      if((n=fgetc(fp))!=0)
      {
      map[i][j]=n;
      map[i][j]-='0';
       j++;
       if(j==64)
       {
           j=0;
           i++;
       }
      }
       if(i==34)break;
   }
    fclose(fp);
}

你可能感兴趣的:(c语言控制台简单小游戏)