| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3532 人关注过本帖, 4 人收藏
标题:(大家看看)花了一个礼拜编的一个 (小游戏)vc环境
只看楼主 加入收藏
zwcwu
Rank: 2
等 级:论坛游民
帖 子:23
专家分:14
注 册:2010-12-24
结帖率:33.33%
收藏(4)
已结贴  问题点数:10 回复次数:37 
(大家看看)花了一个礼拜编的一个 (小游戏)vc环境
#include <iostream>
#include <stdlib.h>
#include <iomanip>
#include <string>
#include <ctime>
#include <conio.h>
#include <windows.h>
#include <cmath>
using namespace std;
SYSTEMTIME Time;
string name;
int HP=80,Defend=17,gold=50,expe=0,L=0,Attack=15;int boss[100]={0};int H[100]={80};
string weapon="弹弓",weapon0="布衣";int temp[100]={0,1,2,3,4,5,6,7,8,9,10,11};
class medicine
{
        int med;medicine *next;
        public:
                medicine *create_medicine();
        void show_medicine(medicine*);
        void buy_medicine(int i,int x);
            void drink_medicine(int i,int x);
};
medicine l;
medicine*head=l.create_medicine();


medicine* medicine::create_medicine()//创建结点
{
    medicine*p1,*p2;
    p1=new medicine;
    p2=p1;
    head=p1;
    p2=p1;
    p1=new medicine;
    p2->next=p1;
    delete p1;p2->next=NULL;
    return head;
}


void medicine::drink_medicine(int j,int i)//删除链表结点
{
        medicine*p=head;j=0;
    while(p&&p->next->med!=i)
    {
        p=p->next;
        j++;
    }
   if(!p)delete p;
   else
   {
                medicine*l=p->next;
        p->next=l->next;
                delete l;
        }
}
        


void medicine::show_medicine(medicine*h)
{
        char m;medicine d;
        h=::head;medicine*l=::head;
    cout<<"药品信息如下:\n";//显示链表信息
    while(h)
    {
                if(h->med==1)
        cout<<h->med<<"------"<<"参丸,HP恢复 80"<<endl;
                if(h->med==2)
        cout<<h->med<<"------"<<"大参丸,HP恢复 150"<<endl;
                if(h->med==3)
        cout<<h->med<<"------"<<"人参,HP恢复 500"<<endl;
                if(h->med==4)
        cout<<h->med<<"------"<<"灵丹,HP恢复 1000"<<endl;
               h=h->next;
    }
        if(head)
        {
               
                cout<<"你要服用的是:";cin>>m;char n=m;
                while(l)
                {
                        if(l->med!=1&&l->med!=2&&l->med!=3&&l->med!=4){m='0';}
                        else {m=n;break;}
                        l=l->next;
                }
                if(m=='1')
        {cout<<"你快速服下参丸,HP恢复 了"<<endl;::HP+=80;if(::HP>H[L])::HP=H[L];d.drink_medicine(0,1);}
                if(m=='2')
        {cout<<"你快速服下大参丸,HP恢复 了"<<endl;::HP+=150;if(::HP>H[L])::HP=H[L];d.drink_medicine(0,2);}
                if(m=='3')
        {cout<<"你快速服下人参,HP恢复 了"<<endl;::HP+=500;if(::HP>H[L])::HP=H[L];d.drink_medicine(0,3);}
                if(m=='4')
       {cout<<"你快速服下灵丹,HP恢复 了"<<endl;::HP+=1000;if(::HP>H[L])::HP=H[L];d.drink_medicine(0,4);}
                if(m!='1'&&m!='2'&&m!=3&&m!='4'){cout<<endl<<"没有这种药......\n";}
        }
         else
         {cout<<"对不起,你的药品用完了\n";}
        
}


void medicine::buy_medicine(int i,int x)//向链表添加结点
{
    medicine*p=head;int j=0;
    while(p&&j<i-2)
    {
        p=p->next;
        j++;
    }
    if(!p)delete p;
    else
    {
        medicine*s;
        s=new medicine;s->med=x;
        s->next=p->next;
        p->next=s;
    }
}





class System:public medicine//游戏系统类继承medicine类
{

public:
        void menu();
        void upgrade();
        void upgrade1(int ,int ,int );
        void begin();
        void map1();
        void map2();
        void sys(){system("pause");system("cls");}
        void syst(){getche();system("cls");}
        void root1();
        void root2();
        void map_weapon1();
    void condition();
        void map_tool1();
        void show_tool0(string namew1,int money1,int add_attack1,string namew2,int money2,int add_attack2,string namew3,int money3,int add_attack3,string namew4,int money4,int add_attack4);
        void show_my_weapon(int w,string nameweapon,int money,int add_attack);
        void show_my_weapon0(int w,string nameweapon,int money,int add_attack);
        void show_weapon1(string namew1,int money1,int add_attack1,string namew2,int money2,int add_attack2,string namew3,int money3,int add_attack3,string namew4,int money4,int add_attack4);
        void show_weapon0(string namew1,int money1,int add_attack1,string namew2,int money2,int add_attack2,string namew3,int money3,int add_attack3,string namew4,int money4,int add_attack4);

        void map(string north,string south,string west,string east)
        {
                System s;s.gotoxy(22,0);cout<<"菜单(m)";
                s.gotoxy(8,48);cout<<(char)24<<" 北(w): "<<north<<"  ";s.gotoxy(12,48);cout<<(char)25<<"南(s): ";cout<<south;
        s.gotoxy(10,35);cout<<"西(a):";cout<<west;cout<<(char)27;s.gotoxy(10,52);cout<<(char)26<<"东(d): ";cout<<east;
        }
        void North(string north)
        {
                System s;s.gotoxy(0,0);cout<<"菜单";
                s.gotoxy(8,48);cout<<(char)24<<" 北(w): "<<north<<"  ";
        }
        void South(string south)
        {
                System s;s.gotoxy(0,0);cout<<"菜单";
                s.gotoxy(12,48);cout<<(char)25<<"南(s): ";cout<<south;
        }
        void East(string east)
        {
                System s;s.gotoxy(0,0);cout<<"菜单";
                s.gotoxy(10,52);cout<<(char)26<<"东(d): ";cout<<east;
        }
        void West(string west)
        {
                System s;s.gotoxy(0,0);cout<<"菜单";
                s.gotoxy(10,35);cout<<"西(a):";cout<<west;cout<<(char)27;
        }
        void show1(int HP,int Attack,int Defend,int L,int expe)
        {
                HP=::HP;Attack=::Attack;L=::L;expe=::expe;
                cout<<"\n\n\n英雄名字:\t"<<name<<"\n\n\n"<<"血气 HP:\t"<<HP<<"\n\n\n攻击:\t\t";cout<<Attack;cout<<"\n\n\n防卫力:\t\t"<<Defend<<"\n\n\n等级 L:\t\t"<<L<<"\n\n\n经验值:\t\t"<<expe<<"\n\n\n\n\n\n";system("pause");system("cls");
        }

    void gotoxy(int x,int y)
        {
         COORD position={0,0};
             HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
             position.X=y;position.Y=x;
             SetConsoleCursorPosition(hOut,position);
        }
        void laduo()
        {
                System s;
                s.gotoxy(1,10);
            cout<<"拉多镇";
        }
        void house()
        {
                System s;
                s.gotoxy(2,26);
        }
            
        void where(){System s;s.gotoxy(14,16);cout<<"你想去哪?";}
        void east()
                {
                System s;
                system("cls");
                for(int i=50;i>30;i=i-2){s.gotoxy(8,i);cout<<(char)26<<" ";}s.gotoxy(10,34);cout<<"你正在往东走....";s.gotoxy(16,50);s.sys();
                }
        void west()
                {
                System s;
                system("cls");
                for(int i=28;i>14;i=i-2){s.gotoxy(8,i);cout<<(char)27<<" ";}s.gotoxy(10,16);cout<<"你正在往西走....";s.gotoxy(16,50);s.sys();
                }
        void south()
        {
                System s;
                system("cls");
                for(int i=6;i<13;i++){s.gotoxy(i,32);cout<<(char)25;}s.gotoxy(15,32);cout<<"你正在往南走....";s.gotoxy(22,50);s.sys();
        }
        void north()
        {
                System s;
                system("cls");
                for(int i=12;i>5;i--){s.gotoxy(i,32);cout<<(char)24;}s.gotoxy(14,32);cout<<"你正在往北走....";s.gotoxy(22,50);s.sys();
        }
        void walk(char x)
        {
                System s;
                if(x=='s'){cout<<"\n\n";s.setjindutiao(25,11);s.south();}
        if(x=='w'){cout<<"\n\n";s.setjindutiao(25,11);s.north();}
        if(x=='d'){cout<<"\n\n";s.setjindutiao(25,11);s.east();}
        if(x=='a'){cout<<"\n\n";s.setjindutiao(25,11);s.west();}
        }
    void fight(string name0,int hp,int attack,int defend,int expe,int money);

    void meet0(string name0,int hp0,int attack0,int defend0,int exp0,int gold0)
        {
                    System sas;
                        system("cls");                                                                                                                                          
                        sas.gotoxy(6,28);cout<<name0<<"出现了!进入战斗......\n\n";sas.gotoxy(14,16);system("pause");
                        sas.setjindutiao(20,10);system("cls");
                        sas.fight(name0,hp0,attack0,defend0,exp0,gold0);system("cls");
                  
        }                                                                                                                                                                                
    void meet1()
        {
                System ss;
                srand(time(0));
                int a=rand()%15;
                switch(a)
                {
                case 0:
             ss.meet0("生物炮",50,30,15,8,4);break;
                case 1:
                        ss.meet0("加农炮",85,128,24,12,8);break;
                case 2:
                        ss.meet0("食人花",110,60,10,15,20);break;
                case 3:
                case 4:
                        ss.meet0("水蛙",120,160,25,30,15);break;
                case 5:
                        ss.meet0("金蚁",30,5,150,5,25);break;
                default:
                        break;
                }
               
        }
        void meet()
        {
                System ss;
                srand(time(0));
                int a=rand()%15;
                if(a==0)
                {
                        ss.meet0("巨蚁",20,10,5,1,2);
                }
                if(a==8)
                {
                        ss.meet0("火焰枪",45,8,8,3,4);
                }
                if(a==10)
                {
                        ss.meet0("杀人虫",45,8,10,3,3);
                }
                if(a==14||a==13)
                {
                        ss.meet0("仿生蜗牛",65,12,12,10,6);
                }
                if(a==12)ss.meet0("金蚁",30,5,50,5,25);
               
        }
/*
10计科班张文长游戏.zip (11.69 KB)


大家有什么问题可以问额 ,比如 喝药系统、购物系统、坐标系统、升级系统、战斗系统、怪物系统、随机遇怪系统、人物状态系统、地图切换等等,或者哪里需要什么改动的,都可以提出来,欢迎大家发言

云中月 制作.zip (580.28 KB)


[ 本帖最后由 zwcwu 于 2011-1-7 23:09 编辑 ]
搜索更多相关主题的帖子: 小游戏 环境 
2010-12-24 19:35
zwcwu
Rank: 2
等 级:论坛游民
帖 子:23
专家分:14
注 册:2010-12-24
收藏
得分:0 
*/void map1_2()
        {
        System s;char direction;
flag3:        s.house();cout<<"这里是小村外";
                s.map("勇士大厅","山洞","小路","荒山");
                s.where();
                cin>>direction;
                s.walk(direction);
                s.meet();

                if(direction=='d')
                {
                        char direction1;
                        s.walk('d');
flag4:                s.house();cout<<"这里是一片荒山";
            s.map("小山腰","山路","小村外","河流");
                        s.where();
                        cin>>direction1;
                        s.walk(direction1);s.meet1();
            if(direction1=='d')
                        {
                                char direction2;
flag5:                        s.house();cout<<"这里是一条河流,远远望去,无边无际";
                                s.gotoxy(10,52);cout<<(char)26<<"东(d): ";cout<<"河口";s.West("小村外");
                                s.where();
                                cin>>direction2;
                                s.walk(direction2);s.meet1();
                                if(direction2=='d')
                                {
                                        char direction3;
                                        s.walk('d');
flag6:                                s.house();cout<<"这里是一条瀑布,大水哗啦哗啦往下流...";
                                        s.map("瀑布北","瀑布南","河流","瀑布东");
                                        s.where();
                                cin>>direction3;
                                s.walk(direction3);s.meet();
                                        if(direction3=='a'){goto flag5;}
                                        if(direction3=='s')
                                        {
                                                char direction10;s.walk('s');s.gotoxy(4,24);cout<<"突然,你感觉不太对劲";s.syst();
flag15:                                        s.house();cout<<"这里是瀑布密洞";s.North("瀑布出口");s.South(" ");s.gotoxy(4,2);cout<<"这里有:";s.gotoxy(6,4);cout<<"水怪部下1";s.gotoxy(8,4);cout<<"水怪部下2";
                                            s.where();cin>>direction10;
                                                if(direction10=='s')
                                                {
                                                        s.walk('s');
                                                        s.gotoxy(6,24);cout<<"水怪部下1:   大胆,大王的寝宫也敢闯";s.gotoxy(8,24);cout<<"水怪部下2: 快来受死吧";s.syst();s.fight("水怪部下1",500,150,220,35,50);s.fight("水怪部下2",800,300,250,69,80);
                                                        s.gotoxy(6,24);cout<<"哼,只不过是几个小喽喽";s.gotoxy(8,24);cout<<"还敢跟本姑娘动手";s.syst();s.walk('s');
                                                        s.gotoxy(6,24);cout<<"你走进了一个黑洞,却发现....";s.syst();s.gotoxy(6,24);cout<<"不明勇士:   丑怪,你在这作威作福,";s.gotoxy(8,24);cout<<"掳走了好多妇女,你知道你值1000两金吗?";s.syst();s.gotoxy(6,24);cout<<"水怪王:  ......";s.syst();s.gotoxy(8,24);cout<<"不明勇士:  哈...哈...哈...哈";s.syst();
                                                        s.gotoxy(6,24);cout<<"你走进洞中,不慌不忙的说:  ";s.gotoxy(8,22);cout<<"没错,但你却不像是能领赏金的人";s.syst();
                                                        s.gotoxy(6,24);cout<<"不明勇士缓缓向后退几步,再拔出兵器";s.syst();s.fight("不明勇士",600,400,350,100,90);//system("cls");
                                                        s.gotoxy(6,24);cout<<"水怪王:  天堂有路你不走,地狱无门你偏闯,看招";s.syst();s.fight("水怪王",800,490,400,100,100);s.walk('w');s.walk('w');boss[0]=1;goto flag15;
                                                }
                                                if(direction10=='w'){s.walk('w');s.walk('w');goto flag6;}
                                                if(direction10=='m'){s.menu();goto flag15;}
                                                if(direction10!='s'&&direction10!='w'&&direction10!='m'){s.gotoxy(6,24);cout<<"请往北或者南走...";s.syst();goto flag15;}
                                        }
                                        if(direction3!='a'&&direction3!='s'&&direction3!='m')
                                        {
                                                s.sys();
                                                s.gotoxy(4,24);cout<<"这儿瀑布一泻千里,不管从哪个角度,煞是好看!!!";
                                                s.gotoxy(12,24);s.sys();
                                                s.gotoxy(6,26);cout<<"你恋恋不舍往回走...";s.gotoxy(12,28);s.sys();s.meet1();goto flag6;
                                        }
                                        if(direction3=='m'){s.menu();goto flag6;}
                                }
                                if(direction2=='a'){s.walk('a');s.meet1();goto flag4;}
                        
                                
                                if(direction2!='a'&&direction2!='d')
                                {
                                        s.gotoxy(4,24);cout<<"这里没路,只有一大片芦苇...";s.syst();goto flag5;
                                }
                        }


                        if(direction1=='a'){s.walk('a');s.meet1();goto flag3;}
                        if(direction1!='a'&&direction1!='d')
                        {
                                s.gotoxy(4,24);cout<<"这里山太高,过不去了...";s.syst();goto flag4;
                        }
                }
                if(direction=='w')
                {
                        s.meet1();s.map1();
                }









                if(direction=='a')
                {



                            char direction4;
flag7:                        s.house();cout<<"这里是一条小路,不知是通往哪儿的";
                                s.gotoxy(10,35);cout<<(char)27<<"西(a)"<<"徜徉小路";s.gotoxy(10,52);cout<<(char)26<<"东(d): ";cout<<"小村外";
                                s.where();cin>>direction4;
                                s.walk(direction);s.meet1();






                                if(direction4=='a')
                                {



                                        char direction5;s.walk('a');
flag8:                                s.house();cout<<"这里是徜徉小路,路上没有一个人,带着几丝凉意";
                                        s.gotoxy(8,48);cout<<(char)24<<" 北(w): "<<"新小路";s.East("小路");
                                        s.where();cin>>direction5;s.walk(direction5); s.meet1();




                                        if(direction5=='w')
                                        {
                                                s.walk('w');
                                                char direction6;
flag9:                                    s.house();cout<<"这里是新小路,远方似乎有一人家...";
                                                s.North("客栈");s.South("徜徉小路");s.East("新小镇");
                                                s.where();cin>>direction6;s.walk(direction6);s.meet();
                                                if(direction6=='w')




                                                {
                                                        char direction7;s.walk('w');
flag10:                                            s.house();cout<<"这里是一家客栈...";
                                                                s.map("老板处","新小路","休息处","喝茶处");
                                                                s.where();cin>>direction7;s.walk(direction7);
                                                                if(direction7=='w')
                                                                {

                                                                        s.gotoxy(4,50);cout<<"老板:欢迎光临!你想过去吗?";s.syst();s.gotoxy(6,50);cout<<"1.想去";s.gotoxy(8,50);cout<<"2.不想";s.gotoxy(10,50);cout<<"3.我想来杯茶";
                                                char choice;s.gotoxy(14,16);cin>>choice;
                                                                         switch(choice)
                                                                         {
                                                    case '1':
                                                        system("cls");s.gotoxy(4,24);cout<<"不行,你级数不够,等你20级再过去吧...";s.syst();s.gotoxy(6,24);cout<<"你说:哼!你太小瞧我了,我马上升级给你看...";s.syst();
                                                                s.gotoxy(8,24);s.gotoxy(6,24);cout<<"老板:好啊,那你做给我看看,我看没多久就被怪物咬了...";s.gotoxy(8,24);s.sys();goto flag10;
                                                    case '2':
                                                        system("cls");s.gotoxy(4,24);cout<<"哦,那你在附近走走吧...";s.syst();goto flag10;
                                                    case '3':
                                                        system("cls");s.gotoxy(4,50);cout<<"你先坐,稍后就来了!";s.syst();goto flag10;
                                                    default:
                                                        system("cls");s.gotoxy(4,50);cout<<"下次再来!";s.syst();goto flag10;
                                                                         }

                                                                }
                                                                        if(direction7=='s'){s.walk('s');goto flag9;}
                                                                        if(direction7=='a')
                                                                        {
                                                                                system("cls");
                                    s.gotoxy(4,50);cout<<"女服务员:欢迎光临!什么事?";s.syst();s.gotoxy(6,50);cout<<"1.小睡一会";s.gotoxy(8,50);cout<<"2.过一晚上";s.gotoxy(10,50);cout<<"3.看看就走";
                                    char choice;s.gotoxy(14,16);cin>>choice;
                                    switch(choice)
                                                {
                                      case '1':
                                            system("cls");s.gotoxy(4,24);cout<<"哦,那你休息,不打扰了!";s.syst();s.gotoxy(6,24);cout<<"不过一会,你就睡着了,看来是太累了...";s.syst();
                                                    s.gotoxy(8,24);s.sys();s.setjindutiao(45,13);system("cls");s.gotoxy(6,24);cout<<"经过休息,你精神更加充沛了...";::HP=H[L];s.syst();goto flag10;
                                      case '2':
                                            system("cls");s.gotoxy(4,24);cout<<"哦,那你进来吧!!!";s.syst();s.gotoxy(6,24);cout<<"你一睡,就不知道什么时候了,看来真的是太累了...";s.syst();
                                                    s.gotoxy(8,24);s.setjindutiao(80,13);system("cls");s.gotoxy(6,24);cout<<"经过休息,你精神充沛了...";::HP=H[L];s.syst();goto flag10;
                                      case '3':
                                            system("cls");s.gotoxy(4,50);cout<<"请下次再来哦!";s.syst();goto flag10;
                                      default:
                                            system("cls");s.gotoxy(4,50);cout<<"请下次再来哦!";s.syst();goto flag10;
                                                }



                                                                        }

                                                



                                                                        if(direction7=='d')
                                                                        {
                                                                             s.gotoxy(4,25);cout<<"茶客说:    小心,前面的怪物很凶!! !\n";s.gotoxy(6,34);s.sys();goto flag10;
      
                                                                        }
                                                                        
                                                                        if(direction7!='w'&&direction7!='s'&&direction7!='a'&&direction7!='d')
                                                                        {
                                                                                s.gotoxy(4,26);cout<<"没有这个方向...\n";s.gotoxy(6,26);s.sys();goto flag10;
                                                                        }
                                                }




                                                        if(direction6=='s'){s.walk('s');goto flag8;}
                                                        if(direction6=='m'){s.menu();goto flag9;}
                                                        if(direction6=='d'){s.walk('d');s.gotoxy(6,24);cout<<"你来到这里,却发现有一片栅栏挡在前方";getche();s.gotoxy(8,24);cout<<"于是你 悻悻地离开了";s.syst();goto flag9;};
                                                        if(direction6!='w'&&direction6!='s'&&direction!='m'&&direction!='d'){s.sys();s.gotoxy(4,26);cout<<"这边没路";s.gotoxy(6,26);s.sys();goto flag9;}

                                        }




                    if(direction5!='w'&&direction5!='d'){s.gotoxy(4,24);cout<<"这边路不通";s.gotoxy(6,24);s.sys();goto flag8;}
                    if(direction5='d'){s.meet1();goto flag7;}
                                }




                                        if(direction4=='d'){s.map1_2();}
                                        if(direction4!='a'&&direction!='d')
                                        {
                                                s.gotoxy(4,24);cout<<"没有这边的路";s.gotoxy(6,24);s.sys();goto flag7;
                                        }
                }
/*
2010-12-24 19:35
zwcwu
Rank: 2
等 级:论坛游民
帖 子:23
专家分:14
注 册:2010-12-24
收藏
得分:0 
*/if(direction=='s')
                {
                        char direction8;
                        s.gotoxy(4,26);cout<<"你继续往洞中走...";s.syst();s.walk('s');s.meet();

flag11:                s.house();cout<<"这里黑洞洞的,甚是可怕...";s.map("洞出口","方洞","圆洞","石洞");
                        s.where();cin>>direction8;s.walk(direction8);s.gotoxy(6,22);cout<<" 这里阴森森的,但你仍毫无顾忌的进去";getche();system("cls");s.walk(direction8);
                        if(direction8=='w')
                        {
                                s.gotoxy(6,26);cout<<"周围渐渐明亮起来了...";s.syst();s.walk('w');s.meet1();goto flag3;
                        }






                        if(direction8=='d')
                        {
                                s.walk('d');s.gotoxy(4,24);cout<<"突然,你看见一群类似野人的在啃着什么东西";s.gotoxy(6,24);s.sys();
                                s.gotoxy(6,26);cout<<"你走上前去...";s.syst();
                                        system("cls");
flag12:                                s.house();cout<<"这里是石洞...";s.gotoxy(12,24);s.sys();
                            s.gotoxy(4,50);cout<<" 它们正盯着你,一副凶神恶煞的样子......";s.syst();s.gotoxy(6,50);cout<<"1.冒险前去问问它们在 干嘛";s.gotoxy(8,50);cout<<"2.在这里转转";s.gotoxy(10,50);cout<<"3. 赶忙转头回去";
                            char choice;s.gotoxy(14,16);cin>>choice;
                            switch(choice)
                                {
                                 case '1':
                                                 char choose;
                                         system("cls");s.gotoxy(4,24);cout<<" 嗷...嗷...嗷...";s.gotoxy(6,24);cout<<"嗷...嗷...?,1 是, 2 否";
                                             s.gotoxy(8,24);cin>>choose;s.sys();if(choose==2)s.sys();
                                                 if(choose=='1')
                                                 {
                                                         s.gotoxy(8,24);cout<<"一伙野人向你扑来......";s.syst();
                                                         s.fight("野人1",150,36,128,30,55);s.fight("野人2",450,236,228,50,55);
                                                         s.fight("野人3",850,436,328,80,55);
                                                 }
                                                 goto flag12;
                                 case '2':
                        
                                            system("cls");s.gotoxy(4,20);cout<<" 你并不怕它们,在这里走来走去";s.gotoxy(6,22);cout<<"原来它们在撕咬着一匹活狼";
                                                s.gotoxy(8,24);cout<<"狼的嗷叫声依然清脆响耳";s.syst();goto flag12;
                                       
                                     case '3':
                                    system("cls");s.gotoxy(4,50);cout<<" 你见状匆忙的跑出去了";s.syst();s.walk('a');s.meet1();s.walk('a');goto flag11;
                                default:
                                    system("cls");s.gotoxy(4,50);cout<<" 你见状匆忙的跑出去了";s.syst();s.walk('a');s.meet1();s.walk('a');goto flag11;
                                }



                        }







                        if(direction8=='a')
                        {
                                char direction9;
flag13:                        s.house();cout<<"这里是圆洞";s.East("黑洞");
                                s.where();cin>>direction9;s.walk(direction9);
                                if(direction9='d'){s.walk('d');s.meet1();goto flag11;}
                                else
                                {
                                        s.gotoxy(6,26);cout<<"没路哦 ...";s.syst();s.meet();goto flag13;
                                }
                        }



                                        if(direction8=='s')
                                        {
                                                s.walk('s');s.walk('s');s.gotoxy(6,26);
                                                char choice1;
flag14:                                s.house();cout<<" 这里是一间很黑的密洞...";s.gotoxy(4,50);cout<<"这里 有:";s.gotoxy(6,50);cout<<"1.   小石 箱";s.gotoxy(8,50);cout<<"2.   小木 箱";s.gotoxy(10,50);cout<<"3.   石盒 子";s.gotoxy(12,50);cout<<"4.   离开";
                                        s.gotoxy(14,50);cin>>choice1;
                                    switch(choice1)
                                        {
                                 case '1':
                                                 system("cls");if(temp[3]==3) {s.gotoxy(6,24);cout<<"你打开小木箱,发现了一个大参 丸!";s.buy_medicine(1,2);temp[3]=0;}else {s.gotoxy(6,24);cout<<"这里没 有物品了";}s.syst();goto flag14;
                                         case '2':
                                                 system("cls");if(temp[4]==4) {s.gotoxy(6,24);cout<<"你打开小皮箱,发现了一颗灵 丹!";s.buy_medicine(1,4);temp[4]=1;}else {s.gotoxy(6,24);cout<<"这里没 有物品了";}s.syst();goto flag14;
                     case '3':
                                                 system("cls");if(temp[5]==5) {s.gotoxy(6,24);cout<<"你打开小木箱,发现了300金!";::gold+=300; temp[5]=2;}else {s.gotoxy(6,24);cout<<"这里没有物品了";}s.syst(); goto flag14;
                                         case '4':
                                                 s.walk('w');s.meet();s.walk('w');s.meet1();s.walk('w');goto flag11;
                                         default:
                                                 s.syst();goto flag14;
                                                
                                        }

                                        }








                                                if(direction8!='w'&&direction8!='s'&&direction8!='a'&&direction8!='d')
                                                {
                                                        s.gotoxy(6,26);cout<<" 没有这个方向\n";s.gotoxy(6,28);s.syst();goto flag11;
                                                }
                }




                if(direction=='m'){system("cls");s.menu();goto flag5;}
                if(direction!='w'&&direction!='a'&&direction!='s'&&direction!='d'&&direction!='m')
                {
                        s.sys();s.gotoxy(4,24);cout<<"没有这个方向\n";goto flag5;
                }
        }

        





        void map1_1()
        {
flag4:        System s;char direction;
                s.house();cout<<"这里是小服务站";
                s.map("信息查询处","勇士大厅","勇士办事处"," ");
                s.where();
                cin>>direction;
                s.meet();
                if(direction=='s'){s.walk('s');s.meet();s.map1();}
                if(direction=='w'){s.walk('w');s.meet();s.map2();}
                if(direction=='a')
                {
                        s.walk('a');
flag:                char choose;
                    s.house();cout<<"这里是勇士办事处";
                        s.gotoxy(8,48);cout<< (char)24<<" 北(w): "<<"喝茶 处"<<" ";s.gotoxy(12,48);cout<<(char)25<<"南 (s): ";cout<<"喝茶处";
            s.gotoxy(10,35);cout<<(char)27;s.gotoxy(10,52);cout<<(char)26<<"东(d): ";cout<<"小服务站";
                        s.where();cin>>choose;
                        if(choose=='a')
                        {
                                system("cls");
                            s.gotoxy(4,50);cout<<" 欢迎光临猎人商店!什么事?";s.syst();s.gotoxy(6,50);cout<<"1.听情 报";s.gotoxy(8,50);cout<<"2.领赏金";s.gotoxy(10,50);cout<<"3.没 事";
                            char choice;s.gotoxy(14,16);cin>>choice;
                            switch(choice)
                                {
                                 case '1':
                                     system("cls");s.gotoxy(4,24);cout<<"布告上的水怪躲在东边的瀑布里,";s.syst();goto flag;
                                 case '2':
                                    if(boss[0]==0)
                                        {
                                            system("cls");s.gotoxy(4,20);cout<<" 看一下墙上的通缉令,";s.gotoxy(4,22);cout<<"那儿写着打败水怪的人物有重赏 金";s.gotoxy(6,24);cout<<"等你杀了水怪再来找我吧...";s.syst();goto flag;
                                        }
                                    if(boss[0]==1)
                                        {
                                            system("cls");s.gotoxy(4,20);cout<<"恭喜你成功了,你的美名将传遍整个村子,这是你的赏金";
                                            s.gotoxy(6,50);cout<<" 你获得了1000金";::boss[0]=0;::gold=::gold+1000;s.syst();goto flag;
                                        }
                                case '3':
                                    system("cls");s.gotoxy(4,50);cout<<"请您再来!";s.syst();goto flag;
                                default:
                                    system("cls");s.gotoxy(4,50);cout<<"请您再来!";s.syst();goto flag;
                                }
                        }
               
                        if(choose=='w') {s.walk('w');s.sys();s.gotoxy(4,25);cout<<"茶客:    勇士把干掉怪物作为赚钱的途径,祝 你好运 !\n";s.gotoxy(6,34);s.sys();goto flag;}
            if(choose=='s') {s.walk('s');s.sys();s.gotoxy(4,25);cout<<"茶客:    勇士把干掉怪物作为赚钱的途径 , 祝你一路顺风!!\n";s.gotoxy(6,34);s.sys();goto flag;}
                        if(choose=='d'){s.walk('s');s.sys();goto flag4;}
                }
                if(direction!='s'&&direction!='w'&&direction!='a'&&direction!='m'){s.walk('d');goto flag4;}
                if(direction='m'){s.menu();}
        }
        void map1_3()
        {
flag4:        System s;char direction;
                s.gotoxy(2,26);cout<<"这里是我的小屋";
                s.map("睡房","储存中心 ","密室 ","勇士大厅");
                s.where();
                cin>>direction;
                s.walk(direction);
                if(direction=='d'){s.map1();}
                if(direction=='w')
                {
                        s.walk('w');s.gotoxy(4,24);cout<<"姐姐:  终于回来了,累了吧?休息一下吧";::HP=H[L];s.gotoxy(6,24);s.sys();
                        s.gotoxy(6,30);cout<<" 你倒头便 睡.......";s.syst();s.setjindutiao(80,12);system("cls");s.gotoxy(6,24);cout<<" 终于睡醒了......";s.gotoxy(8,24);cout<<"姐姐 :  加油 啊,"<<name<<","<<name<<"保重啊";
                        s.gotoxy(10,24);s.sys();goto flag4;
                }
                if(direction=='s')
                {
               
                            char quit;s.house();cout<<"储存中心";
flag14:                 s.gotoxy(4,50);cout<<" 女服务员: 这里是信息存储中心...";s.syst();s.gotoxy(6,50);cout<<"1.储存游 戏";s.gotoxy(8,50);cout<<"2.退出游戏";s.gotoxy(10,50);cout<<"3.不想 干什么";
                            char choice;s.gotoxy(14,16);cin>>choice;
                            switch(choice)
                                {
                                 case '1':
                                     system("cls");s.gotoxy(4,24);cout<<"吱吱......,储存完毕!";s.syst();goto flag4;
                                 case '2':
                                        system("cls");s.gotoxy(8,24);cout<<" 确认退出?";s.gotoxy(10,24);cout<<"Y/N  ";cin>>quit;
                                if(quit=='Y'||quit=='y'){s.sys();s.gotoxy(8,28);cout<<"晚安,可爱的勇士";getche();}//break ;
                                 if(quit=='N'||quit=='n'){goto flag14;}
                                if(quit!='Y'& amp;&quit!='y'&&quit!='N'&&quit!='n') {s.gotoxy(12,24);cout<<"输入y或者n";s.syst();goto flag14;}
                                          
                                       
                                case '3':
                                    system("cls");s.gotoxy(4,50);cout<<"再见!";s.syst();goto flag4;
                                default:
                                    system("cls");s.gotoxy(4,50);cout<<"再见!";s.syst();goto flag4;
                                
                                
                                }
                }
                        if(direction=='a')
                                {
                                        char choice1;
flag16:                                s.house();cout<<" 这里是一间密室...";s.gotoxy(4,50);cout<<"这里 有:";s.gotoxy(6,50);cout<<"1.   小木 箱";s.gotoxy(8,50);cout<<"2.   小皮 箱";s.gotoxy(10,50);cout<<"3.   柜 子";s.gotoxy(12,50);cout<<"4.   退出";
                                        s.gotoxy(14,50);cin>>choice1;
                                    switch(choice1)
                                        {
                                 case '1':
                                                 system("cls");if(temp[0]==0) {s.gotoxy(6,24);cout<<"你打开小木箱,发现了一个参 丸!";s.buy_medicine(1,1);temp[0]=3;}else {s.gotoxy(6,24);cout<<"这里没 有物品了";}s.syst();goto flag16;
                                         case '2':
                                                 system("cls");if(temp[1]==1) {s.gotoxy(6,24);cout<<"你打开小皮箱,发现了一颗灵 丹!";s.buy_medicine(1,4);temp[1]=4;}else {s.gotoxy(6,24);cout<<"这里没 有物品了";}s.syst();goto flag16;
                     case '3':
                                                 system("cls");if(temp[2]==2) {s.gotoxy(6,24);cout<<"你打开小木箱,发现了30金!";::gold+=30; temp[2]=5;}else {s.gotoxy(6,24);cout<<"这里没有物品了";}s.syst(); goto flag16;
                                         default:
                                                 system("cls");goto flag4;
                                        }
                                }
               
                                if(direction=='m'){s.menu();}
                if(direction!='m'& amp;&direction!='s'&&direction!='w'&&direction!='a'& amp;&direction!='d'){cout<<"这里屋子很黑,还是不要乱走的好\n";s.sys(); goto flag4;}
               
        }

/*
2010-12-24 19:38
zwcwu
Rank: 2
等 级:论坛游民
帖 子:23
专家分:14
注 册:2010-12-24
收藏
得分:0 
*/void map1_4()
        {
flag4:            System s;char direction1;
                //s.meet();
                s.house();cout<<"这里是室外";s.gotoxy(4,22);cout<<"这里有一条曲曲折折的岩石路";
                s.map("旅馆","武器店","勇士大厅","工具店");
                s.where();
                cin>>direction1;
                s.walk(direction1);
                s.meet();
                if(direction1=='a'){s.walk('a');s.map1();}
                if(direction1=='s'){s.walk('s');s.map_weapon1();}
                if(direction1=='d'){s.walk('d');s.map_tool1();}
                if(direction1=='m'){s.menu();}
        if(direction1!='a'&&direction1!='s'&&direction1!='d'&&direction1!='m'){cout<<"这里路不太通畅,还是不要去的好\n";s.sys();goto flag4;}
        }
    void setjindutiao(int p,int z)
        {
     system("cls");
     GetLocalTime(&Time);
     int m=Time.wSecond;
     int s=Time.wHour;
     int f=Time.wMinute;
     SetConsoleTitle("云中月制作"); //标题
     COORD pos; //定义一个位置变量
     pos.X=2; //注意X要大写
     pos.Y=1; //同上Y要大写
     cout<<"╔═════════════════════╗"<<endl;
     cout<<"║                                           ║"<<endl;
     cout<<"╚═════════════════════╝"<<endl;
        cout<<"\t正在连接服务器:"<<s<<":"<<f;
     cout<<"\t红狼与勇士\n";
     SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos); //设置光标在(2,1)位置
     SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),12|1);
     for(int i=0;i<21;i++)
     {
         Sleep(p);
         cout<<"▓";
     }
     SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),z);   //字体色
     cout<<endl;
     cout<<endl;
        }
};




void System::upgrade1(int at,int de,int p)
{
        System sss;

        ::L=::L+1;
        sss.gotoxy(4,28);cout<<name<<"的水平提高了,";sss.gotoxy(6,28);cout<<"等级提升到\t"<<L;::Attack=::Attack+at;::Defend=::Defend+de;::HP=p;H[L]=p;
        sss.gotoxy(8,28);cout<<"攻击力增加了"<<at;sss.gotoxy(10,28);cout<<"防御力增加了"<<de;sss.gotoxy(12,28);cout<<"最大HP值增加到"<<p;
        sss.gotoxy(14,28);
        sss.sys();
}
void System::upgrade()
{
        System ss;
        int e=::expe;

        if(L<1&&e>=18)
        {
                ss.upgrade1(3,6,110);
        }
        if(L<2&&e>=30)
        {
                ss.upgrade1(5,8,125);
        }
        if(L<3&&e>=50)
        {
                ss.upgrade1(8,9,160);
        }
        if(L<4&&e>=80)
        {
                ss.upgrade1(15,12,180);
        }
        if(L<5&&e>=150)
        {
                ss.upgrade1(22,18,220);
        }
        if(L<6&&e>=250)
        {
                ss.upgrade1(30,24,380);
        }
        if(L<7&&e>=500)
        {
                ss.upgrade1(50,40,610);
        }

        if(L>=7)
        {
               
        int AT=(L+1)*(L+1)*log(L+3);
            int DE=(L+1)*(L+1)*log(L+3);
             int HH=8*(L)*log(L);
                int EX=(int)16*(L)*log(pow(2,L)*L*L);
                if(L<L+1&&e>=EX)
                ss.upgrade1(AT,DE,HH);
        }

}
void System::fight(string name0,int hp,int attack,int defend,int expe,int money)
        {
        
            
                System s;s.gotoxy(4,28);cout<<"你见到后大怒道:";s.gotoxy(6,32);cout<<"臭贼!";s.gotoxy(8,26);cout<<"今日不是你死就是我活!!!";s.gotoxy(12,30);cout<<name0<<"看起来想杀你!";s.gotoxy(18,16);s.sys();
flag20:        char choice;int two;int h=hp;int H0=::HP;
                s.gotoxy(4,12);cout<<name<<"的HP:"<<::HP;s.gotoxy(6,12);cout<<"攻击力: "<<Attack;
                s.gotoxy(4,50);cout<<name0<<"的HP:"<<hp;s.gotoxy(6,50);cout<<"攻击力:  "<<attack;
 flag:  s.gotoxy(10,28);cout<<"1.攻击 2.工具 3.逃跑";s.gotoxy(11,28);cin>>choice;
            char choose='1';        
            if(choice=='1')
                {
                    s.sys();s.gotoxy(4,12);cout<<name<<"攻击";s.gotoxy(6,12);
                                int hpment1=Attack*0.75-defend*0.5;   if(hpment1<0)hpment1=0;

                                        int hpment2=Attack*2*0.6-defend*0.5;   if(hpment2<0)hpment2=0;

                                        int hpment3=(int)(Attack*2*0.5-defend*0.5);    if(hpment3<0)hpment3=0;

                                        int Hpment1=attack*2-Defend*0.5;   if(Hpment1<0)Hpment1=0;

                                        int Hpment2=(int)(attack*2*0.8-Defend*0.5);   if(Hpment2<0)Hpment2=0;

                                        int Hpment3=attack*2*1.2-Defend*0.5;if(Hpment3<0)Hpment3=0;
                    
                        while(1)
                        {   srand(time(0));
                        
                                if(choose=='1')
                                {
                                
                                    s.gotoxy(4,12);cout<<name<<"攻击";s.gotoxy(6,12);
                                    two=rand()%3;
                                        if(two==0){hp=hpment1,cout<<name0<<"损伤了"<<hp<<"\n\n\n";system("pause");}if(two==1){hp=hpment2,cout<<name0<<"损伤了"<<hp<<"\n\n\n";system("pause");}if(two==2){hp=hpment3,cout<<name0<<"损伤了"<<hp<<"\n\n\n";system("pause");}
                    s.gotoxy(4,40);cout<<name0<<"攻击";s.gotoxy(6,40);
                    if(two==0){HP=Hpment1,cout<<name<<"损伤了"<<HP<<"\n\n\n";s.sys();}if(two==1){HP=Hpment2,cout<<name<<"损伤了"<<HP<<"\n\n\n";s.sys();}if(two==2){HP=Hpment3,cout<<name<<"损伤了"<<HP<<"\n\n\n";s.sys();}
                                h=h-hp;H0=H0-HP;
                                
                                    if(h<=0){s.gotoxy(4,18);cout<<"打倒了"<<name0<<", 教训了敌人,";s.gotoxy(6,18);cout<<"获得"<<expe<<"分经验值 ,"<<money<<"金到手了!!!\n\n\n";::HP=H0;::expe=::expe+expe;::gold+=money;s.sys(),s.upgrade();return ;}
                                    if(H0<=0){s.gotoxy(4,14);cout<<"你眼前突然一黑,接着什么也不知道了.......\n\n\n";s.syst();s.gotoxy(6,14);cout<<"很遗憾,你死了,记得先去睡觉额";s.gotoxy(10,14);system("pause");::HP=H0;s.sys();s.map1();break;}
                                }
                                if(choose=='2')
                                {
                                       
                                        s.show_medicine(head);
                                s.sys();goto flag20;
                                }
                                if(choose=='3')
                                {
                                                int hpment1=Attack*0.75-defend*0.5;   if(hpment1<0)hpment1=0;

                                        int hpment2=Attack*2*0.6-defend*0.5;   if(hpment2<0)hpment2=0;

                                        int hpment3=(int)(Attack*2*0.5-defend*0.5);    if(hpment3<0)hpment3=0;

                                        int Hpment1=attack*2-Defend*0.5;   if(Hpment1<0)Hpment1=0;

                                        int Hpment2=(int)(attack*2*0.8-Defend*0.5);   if(Hpment2<0)Hpment2=0;

                                        int Hpment3=attack*2*1.2-Defend*0.5;if(Hpment3<0)Hpment3=0;
                                        s.sys();s.gotoxy(12,28);
                                        srand(time(0));int b=rand()%3;
                                        if(b==2){cout<<"你逃跑了......";getche();return;}
                                        if(b==1||b==0)
                                        {
                                                srand(time(0));
                                                cout<<"你正在逃跑,但被怪物包围了......\n";
                                                int two=rand()%3;
                                                s.syst();
                                                s.gotoxy(4,40);cout<<name0<<"攻击";s.gotoxy(6,40);
                        if(two==0){HP=Hpment1,cout<<name<<"损伤了"<<HP<<"\n\n\n";s.sys();}if(two==1){HP=Hpment2,cout<<name<<"损伤了"<<HP<<"\n\n\n";s.sys();}if(two==2){HP=Hpment3,cout<<name<<"损伤了"<<HP<<"\n\n\n";s.sys();}
                        
                                             H0=H0-HP;::HP=H0;
                                                if(h<=0)
                                                {
                                                        s.gotoxy(4,18);cout<<"打倒了"<<name0<<", 教训了敌人,";s.gotoxy(6,18);cout<<"获得"<<expe<<"分经验值 ,"<<money<<"金到手了!!!\n\n\n";
                                                        ::HP=H0;::expe=::expe+expe;::gold+=money;
                                                    s.upgrade();
                                                        s.sys();return;
                                                }
                                        if(H0<=0){s.gotoxy(4,14);cout<<"你眼前突然一黑,接着什么也不知道了.......\n\n\n";s.syst();s.gotoxy(6,18);cout<<"很遗憾,你死了,记得先去睡觉额";s.gotoxy(10,14);system("pause");::HP=H0;s.sys();s.map1();break;}//break;
                                            goto flag;
                                        }
                                }
                                s.gotoxy(10,28);cout<<"1.攻击 2.工具 3.逃跑";s.gotoxy(11,28);cin>>choose;
                                
                        }
                        
                }
               
        
                if(choice=='2')
                {
               
                        s.show_medicine(head);
                                            s.sys();goto flag20;
                }
                if(choice=='3')
                {
                                int hpment1=Attack*0.75-defend*0.5;   if(hpment1<0)hpment1=0;

                                        int hpment2=Attack*2*0.6-defend*0.5;   if(hpment2<0)hpment2=0;

                                        int hpment3=(int)(Attack*2*0.5-defend*0.5);    if(hpment3<0)hpment3=0;

                                        int Hpment1=attack*2-Defend*0.5;   if(Hpment1<0)Hpment1=0;

                                        int Hpment2=(int)(attack*2*0.8-Defend*0.5);   if(Hpment2<0)Hpment2=0;

                                        int Hpment3=attack*2*1.2-Defend*0.5;if(Hpment3<0)Hpment3=0;
                                        srand(time(0));int b=rand()%3;
                                        if(b==2){cout<<"你逃跑了......";s.sys();return;}
                                        if(b==1||b==0)
                                        {
                                                cout<<"你正在逃跑,但被怪物包围了......";choice=1;s.syst();//goto flag;
                                            int two=rand()%3;
                                                s.gotoxy(4,40);cout<<name0<<"攻击";s.gotoxy(6,40);
                        if(two==0){HP=Hpment1,cout<<name<<"损伤了"<<HP<<"\n\n\n";s.sys();}if(two==1){HP=Hpment2,cout<<name<<"损伤了"<<HP<<"\n\n\n";s.sys();}if(two==2){HP=Hpment3,cout<<name<<"损伤了"<<HP<<"\n\n\n";s.sys();}
                                    
                        
                                                H0=H0-HP;::HP=H0;
                                                if(h<=0)
                                                {
                                                        s.gotoxy(4,12);cout<<"打倒了"<<name0<<", 教训了敌人,";s.gotoxy(6,12);cout<<"获得"<<expe<<"分经验值 ,"<<money<<"金到手了!!!\n\n\n";
                                                        ::HP=H0;::expe=::expe+expe;::gold+=money;
                                                    s.upgrade();
                                                        s.sys();return;
                                                }
                                        if(H0<=0){s.gotoxy(4,14);cout<<"你眼前突然一黑,接着什么也不知道了.......\n\n\n";s.syst();s.gotoxy(6,14);cout<<"很遗憾,你死了,记得先去睡觉额";s.gotoxy(10,18);system("pause");::HP=H0;s.sys();s.map1();}//break;*/
                                            goto flag;
                                       
                                                               
                                        }
                }
                if(choice!='1'&&choice!='2'&&choice!='3')
                {
                        system("cls");
                        s.gotoxy(10,30);cout<<"对不起,输入错误";s.gotoxy(12,30);cout<<"请按数字+enter键继续  ";s.syst();
                        goto flag;
                }
        }

/*
2010-12-24 19:39
zwcwu
Rank: 2
等 级:论坛游民
帖 子:23
专家分:14
注 册:2010-12-24
收藏
得分:0 
*/void System:: root1()
{
        System s;
flag1:char choice;
        s.gotoxy(4,30);cout<<"\t1.创 建 角 色"<<endl;
        s.gotoxy(6,30);cout<<"\t2.查 看 人 物 属 性"<<endl;
        s.gotoxy(8,30);cout<<"\t3.游 戏 介 绍"<<endl;
    cin>>choice;
    if(choice!='1'&&choice!='2'&&choice!='3'){cout<<"输入不正确,重新进入游戏吧!";cout<<(char)2<<(char)2<<(char)2<<endl;system("pause");system("cls");goto flag1;}
        if(choice=='1'){cout<<"注册用户名:";cin>>name;cout<<"\n\n\n\n\n";s.gotoxy(14,30);cout<<"创建成功,英雄的名字叫作:"<<name<<"\n\n\n\n\n\n";system("pause");system("cls");}
        if(choice=='2'){cout<<"对不起,您还没创建角色!";system("pause");system("cls");goto flag1;}
        if(choice=='3'){cout<<"\n\n\n天下英雄,究竟是谁?";cout<<"\n\n\n想成为万人瞩目的勇士吗?";cout<<"\n\n\n那就开始你的冒险之旅吧!!!";cout<<"\n\n\n\n";system("pause");system("cls");goto flag1;}//system("pause");system("cls");

}

void System::root2()
{
        System s;
flag2:char choice;
        s.gotoxy(4,30);cout<<"\t1.进 入 游 戏"<<endl;
        s.gotoxy(6,30);cout<<"\t2.查 看 人 物 属 性"<<endl;
        s.gotoxy(8,30);cout<<"\t3.游 戏 介 绍"<<endl;
        s.gotoxy(10,30);cout<<"\t4.我 的 装 备"<<endl;
        cin>>choice;
        if(choice=='1'){cout<<"正在进入中......\n\n\n";s.setjindutiao(50,11);system("cls");return;}
        if(choice=='2'){cout<<"\n\n\n英雄名字:\t"<<name<<"\n\n\n"<<"血气 HP:\t"<<HP<<"\n\n\n攻击:\t\t";cout<<Attack;cout<<"\n\n\n防卫:\t\t17"<<"\n\n\n等级 L:\t\t"<<L<<"\n\n\n经验值:\t\t"<<expe<<"\n\n\n\n\n\n";system("pause");system("cls");goto flag2;}
        if(choice=='3'){cout<<"\n\n\n天下英雄,究竟是谁?";cout<<"\n\n\n想成为万人瞩目的勇士吗?";cout<<"\n\n\n那就开始你的冒险之旅吧!!!";cout<<"\n\n\n\n";system("pause");system("cls");goto flag2;}
    if(choice=='4'){cout<<"\n\n\n金钱:\t\t50\n\n\n武器: \t\t弹弓\n\n\n";system("pause");system("cls");goto flag2;}
    if(choice!='1'&&choice!='2'&&choice!='3'&&choice!='4')s.gotoxy(12,24);cout<<"没有这个选项...";goto flag2;
}


void System::begin()
{
        System s;
        system("cls");
        cout<<"\n\n\n\t爸爸:     什么,你想成为超级勇士?\n\n\t\t  还没放弃这种无聊的追求,  "<<name<<"\n\n\n";s.sys();
        cout<<"\n\n\n\t姐姐:    爸爸,不要发这样大的火!\n\n\n";system("pause");system("cls");
        cout<<"\n\n\n\t爸爸:    你住嘴!\n\n\n";system("pause");system("cls");
    cout<<"\n\n\n\t爸爸:    人应该老老实实地生活,这才是主要的!\n\n\t\t  说过多少次了,还不懂?\n\n\n";s.sys();
        cout<<"\n\n\n\t爸爸:    这个笨家伙!像你这样的,今天就从家里给我出去!\n\n\t\t  让外面的冷风好好吹吹你那发昏的脑袋吧!\n\n\n";s.sys();
    cout<<"\n\n\n\t爸爸:    快走吧,去哪都行。\n\n\n";s.sys();
        cout<<"\n\n\n\n\n\n\t\t\t\t\t"<<"天 亮 了 !\n\n\n\n\n";system("pause");s.setjindutiao(30,11);system("cls");
        s.laduo();
        s.house();cout<<"勇士大厅";
        s.gotoxy(8,16);
        cout<<"叔叔:     哈哈哈! 怎么了,小家伙!\n\n";s.gotoxy(11,26);cout<<"淘气了,又被家里给赶出来了!?\n\n\n";s.sys();

}
void System::map1()
{
        System s;
flag:    char direction;
               
    s.laduo();s.house();cout<<"这里是勇士大厅";
    s.map("小服务站","出口","屋子","室外");
        s.where();
cin>>direction;
        if(direction=='s'){s.walk('s');s.meet();s.map1_2();}
    if(direction=='w'){s.walk('w');s.meet();s.map1_1();}
        if(direction=='a'){s.walk('a');s.meet();s.map1_3();}
        if(direction=='d'){s.walk('d');s.meet();s.map1_4();}
        if(direction='m'){s.menu();goto flag;}
        if(direction!='d'&&direction!='s'&&direction!='a'&&direction!='w'&&direction!='m')
        {
                s.gotoxy(16,16);cout<<"没有这个方向......";goto flag;
        }
}
void System::map2()
{
        System s;char direction;
                s.house();cout<<"这里是信息查询处";
                s.gotoxy(12,48);cout<<(char)25<<"南(s): ";cout<<"小服务站台";
        s.gotoxy(4,50);cout<<"请问你要查个人信息吗?";getche();s.gotoxy(6,50);cout<<"你的个人信息如下:";getche();system("cls");
                cout<<"\n\n\n\t\t\t英雄名字:\t"<<name<<"\n\n\n\t\t\t"<<"血气 HP:\t"<<HP<<"\n\n\n\t\t\t攻击:\t\t";cout<<Attack;cout<<"\n\n\n\t\t\t防卫:\t\t17"<<"\n\n\n\t\t\t等级 L:\t\t"<<L<<"\n\n\n\t\t\t经验值:\t\t"<<expe<<"\n\n\n\n\n\n";system("pause");system("cls");
flag4:        s.house();cout<<"这里是信息查询处";
                s.gotoxy(12,48);cout<<(char)25<<"南(s): ";cout<<"";s.where();
            cin>>direction;
                if(direction=='s'){s.walk('s');s.meet();s.map1_1();}
        else{system("cls");cout<<"这里只有一间小屋子.......\n";s.sys();goto flag4;}
        
}
void System::show_my_weapon(int w,string nameweapon,int money,int add_attack)
{
        System ds;ds.sys();ds.gotoxy(4,24);cout<<"购买成功!!!系统已为你穿上"<<nameweapon<<"..";
        ds.gotoxy(6,24);cout<<"你的攻击力增加"<<add_attack;::Attack=::Attack+add_attack;ds.syst();
        ::gold=::gold-money;::weapon=nameweapon;
}
void System::show_my_weapon0(int w0,string nameweapon0,int money0,int add_attack0)
{
        System ds;ds.sys();ds.gotoxy(4,24);cout<<"购买成功!!!系统已为你穿上"<<nameweapon0<<"..";
        ds.gotoxy(6,24);cout<<"你的防御力增加"<<add_attack0;::Defend=::Defend+add_attack0;ds.syst();
        ::gold=::gold-money0;::weapon0=nameweapon0;
}
void System::show_weapon1(string namew1,int money1,int add_attack1,string namew2,int money2,int add_attack2,string namew3,int money3,int add_attack3,string namew4,int money4,int add_attack4)
{
        System as;
        as.sys();as.gotoxy(4,45);cout<<"要哪个?";char w;
        as.gotoxy(6,40);cout<<"1."<<namew1<<","<< money1<<  "攻击力增加  "<<add_attack1;
        as.gotoxy(8,40);cout<<"2."<<namew2<<","<< money2<<  "攻击力增加  "<<add_attack2;
        as.gotoxy(10,40);cout<<"3."<<namew3<<","<< money3<<  "攻击力增加  "<<add_attack3;
        as.gotoxy(12,40);cout<<"4."<<namew4<<","<< money4<<  "攻击力增加  "<<add_attack4;
        as.gotoxy(13,40);cin>>w;
        switch(w)
        {
        case '1':
                if(gold>=money1){as.show_my_weapon(w,namew1, money1, add_attack1);break;}else{cout<<"你好像没有那么多钱吧,可以查看你的包裹\n"; break;}
        case '2':
                if(gold>=money1){as.show_my_weapon(w,namew2, money2, add_attack2);break;}else{cout<<"你好像没有那么多钱吧,可以查看你的包裹\n"; break;}
        case '3':
                if(gold>=money1){as.show_my_weapon(w,namew3, money3, add_attack3);break;}else{cout<<"你好像没有那么多钱吧,可以查看你的包裹\n"; break;}
        case '4':
                if(gold>=money1){as.show_my_weapon(w,namew4, money4, add_attack4);break;}else{cout<<"你好像没有那么多钱吧,可以查看你的包裹\n"; break;}
        default:
                as.gotoxy(14,40);cout<<"暂时就这些武器了..."<<(char)2;break;
        }
}

/*
2010-12-24 19:40
zwcwu
Rank: 2
等 级:论坛游民
帖 子:23
专家分:14
注 册:2010-12-24
收藏
得分:0 
*/

void System::show_weapon0(string namew1,int money1,int add_attack1,string namew2,int money2,int add_attack2,string namew3,int money3,int add_attack3,string namew4,int money4,int add_attack4)
{
        System as;
        as.sys();as.gotoxy(4,45);cout<<"要哪个?";char w;
        as.gotoxy(6,40);cout<<"1."<<namew1<<","<< money1<<  "防御增加  "<<add_attack1;
        as.gotoxy(8,40);cout<<"2."<<namew2<<","<< money2<<  "防御力增加  "<<add_attack2;
        as.gotoxy(10,40);cout<<"3."<<namew3<<","<< money3<<  "防御增加  "<<add_attack3;
        as.gotoxy(12,40);cout<<"4."<<namew4<<","<< money4<<  "防御力增加  "<<add_attack4;
        as.gotoxy(13,40);cin>>w;
        switch(w)
        {
        case '1':
                if(gold>=money1){as.show_my_weapon0(w,namew1, money1, add_attack1);break;}else{cout<<"你没有那么多钱,你可以查看你的包裹\n"; break;}
        case '2':
                if(gold>=money1){as.show_my_weapon0(w,namew2, money2, add_attack2);break;}else{cout<<"你没有那么多钱,你可以查看你的包裹\n"; break;}
        case '3':
                if(gold>=money1){as.show_my_weapon0(w,namew3, money3, add_attack3);break;}else{cout<<"你没有那么多钱,你可以查看你的包裹\n"; break;}
        case '4':
                if(gold>=money1){as.show_my_weapon0(w,namew4, money4, add_attack4);break;}else{cout<<"你没有那么多钱,你可以查看你的包裹\n"; break;}
        default:
                as.gotoxy(14,40);cout<<"暂时就这些装备了..."<<(char)2;break;
        }
}

void System::show_tool0(string namew1,int money1,int add_attack1,string namew2,int money2,int add_attack2,string namew3,int money3,int add_attack3,string namew4,int money4,int add_attack4)
{
        System as;
        as.sys();as.gotoxy(4,45);cout<<"要哪个?";char w;
        as.gotoxy(6,40);cout<<"1."<<namew1<<", 需要"<< money1<<  "金,HP增加  "<<add_attack1;
        as.gotoxy(8,40);cout<<"2."<<namew2<<",需要"<< money2<<  "金,HP增加  "<<add_attack2;
        as.gotoxy(10,40);cout<<"3."<<namew3<<",需要"<< money3<<  "金,HP增加  "<<add_attack3;
        as.gotoxy(12,40);cout<<"4."<<namew4<<",需要"<< money4<<  "金,HP增加  "<<add_attack4;
        as.gotoxy(13,40);cin>>w;
        switch(w)
        {
        case '1':
                if(gold>=money1){as.gotoxy(15,35);cout<<"购买成功!!!你获得了一个"<<namew1;::gold-=money1;as.gotoxy(17,14);cout<<"你还剩金钱:   "<<gold<<endl;as.buy_medicine(1,1);break;}
                else{cout<<"你没有那么多钱,请查看你的包裹\n"; break;}
        case '2':
                if(gold>=money2){as.gotoxy(15,35);cout<<"购买成功!!!你获得了一个"<<namew2;::gold-=money2;as.gotoxy(17,14);cout<<"你还剩金钱:   "<<gold<<endl;as.buy_medicine(2,2);break;}
                else{cout<<"你没有那么多钱,请查看你的包裹\n"; break;}
        case '3':
                if(gold>=money3){as.gotoxy(15,35);cout<<"购买成功!!!你获得了一个"<<namew3;::gold-=money3;as.gotoxy(17,14);cout<<"你还剩金钱:   "<<gold<<endl;as.buy_medicine(3,3);break;}
                else{cout<<"你没有那么多钱,请查看你的包裹\n"; break;}
        case '4':
                if(gold>=money4){as.gotoxy(15,35);cout<<"购买成功!!!你获得了一个"<<namew4;::gold-=money4;as.gotoxy(17,14);cout<<"你还剩金钱:   "<<gold<<endl;as.buy_medicine(4,4);break;}
            else{cout<<"你没有那么多钱,请查看你的包裹\n"; break;}
        default:
                as.gotoxy(14,40);cout<<"暂时就这些工具了..."<<(char)2;break;
        }
}

void System::map_weapon1()
{
flag:        System s;char direction;
                s.house();cout<<"这里是武器店";

flag4:        s.gotoxy(8,48);cout<<(char)24<<" 北(w): "<<"小出口"<<" ";s.gotoxy(12,48);cout<<(char)25<<"南(s): 台前";
        s.where();cin>>direction;
                if(direction=='s')
                {
                                system("cls");
                            s.gotoxy(4,50);cout<<"欢迎光临武器店!什么事?";s.gotoxy(6,50);s.syst();s.gotoxy(6,50);cout<<"1.买武器";s.gotoxy(8,50);cout<<"2.买装备";s.gotoxy(10,50);cout<<"3.没事";
                            char choice;s.gotoxy(14,16);cin>>choice;
                            switch(choice)
                                {
                                 case '1':
                                                 s.sys();s.gotoxy(4,44);s.show_weapon1("弩",80,12,"短枪",180,25,"战斧",445,45,"火枪",620,60);s.sys();goto flag4;
                                         case '2':
                                                 s.sys();s.gotoxy(4,44);s.show_weapon0("布衣",40,12,"皮衣",110,22,"披风",340,42,"铁衣",650,72);s.sys();goto flag4;;
                                         case '3':
                                                 system("cls");s.gotoxy(4,44);cout<<"欢迎下次再来!";s.sys();goto flag4;
                                         default:
                                                 system("cls");s.gotoxy(4,44);cout<<"欢迎下次再来!";s.sys();goto flag4;
                                                
                                                
                                }
                }
                if(direction=='w'){s.walk('w');s.syst();s.map1_4();}
                if(direction!='s'&&direction!='w'){cout<<"这里没别的路了啊...";s.sys();goto flag;}
}
void System::menu()
{
        System s;
        char choice;system("cls");
    s.gotoxy(4,20);cout<<"请选择:   ";s.gotoxy(6,24);cout<<"1.我的状态";
        s.gotoxy(8,24);cout<<"2.我的装备";s.gotoxy(10,24);cout<<"3.我的工具";
        s.gotoxy(12,24);cout<<"4.退出";s.gotoxy(14,24);cin>>choice;
        if(choice=='1'){s.condition();}
        if(choice=='2'){system("cls");s.gotoxy(6,24);cout<<"武器:   "<<weapon;s.gotoxy(8,24);cout<<"防具:   "<<weapon0;s.gotoxy(10,24);s.sys();}
        if(choice=='3'){s.sys();cout<<"工具如下:\n";s.show_medicine(head);}
        if(choice=='4')
        {
                system("cls");return;
            

        }
        if(choice!='1'&&choice!='2'&&choice!='3'&&choice!='4'){s.gotoxy(14,24);cout<<"没有这个选项";getche();cout<<"\r";return;}
}


void System::condition()
{
        System s;system("cls");
        s.gotoxy(6,50);cout<<"你的个人信息如下:";system("cls");
        cout<<"\n\n\n\t\t\t"<<"血气 HP:\t"<<HP<<"\n\n\n\t\t\t攻击:\t\t";cout<<Attack;cout<<"\n\n\n\t\t\t防卫:\t\t"<<Defend<<"\n\n\n\t\t\t等级 L:\t\t"<<L<<"\n\n\n\t\t\t经验值:\t\t"<<expe<<"\n\n\n\n\n\n";s.sys();
}
void System::map_tool1()
{
            System s;char direction;
flag:        s.house();cout<<"这里是工具店";
                s.gotoxy(8,48);cout<<(char)27<<" 西(a): "<<"大出口"<<" ";s.gotoxy(12,48);cout<<(char)26<<"东(d): 工具台前";
        s.where();cin>>direction;
                if(direction=='d')
                {
                                system("cls");
                            s.gotoxy(4,50);cout<<"欢迎光临工具店!什么事?";s.syst();s.gotoxy(6,50);cout<<"1.买工具";s.gotoxy(8,50);cout<<"2.看看";s.gotoxy(10,50);cout<<"3.没事";
                            char choice;s.gotoxy(14,16);cin>>choice;
                            switch(choice)
                                {
                                 case '1':
                                                 s.sys();s.gotoxy(4,44);s.show_tool0("参丸",10,100,"大参丸",20,200,"人参",50,500,"灵丹",100,1000);s.syst();goto flag;;
                                         case '2':
                                                 system("cls");s.gotoxy(4,44);cout<<"请自便,但只能看不能摸啊...";s.gotoxy(6,44);s.sys();goto flag;break;            
                                         case '3':
                                                 system("cls");s.gotoxy(4,44);cout<<"欢迎下次再来!";s.gotoxy(6,44);s.sys();goto flag;break;
                                         default:
                                                 system("cls");s.gotoxy(4,44);cout<<"欢迎下次再来!";s.gotoxy(6,44);s.sys();goto flag;break;
                                                
        
                                }
                }
                if(direction=='a'){s.walk('a');s.map1_4();}
                if(direction!='a'&&direction!='d'){s.sys();s.gotoxy(4,24);cout<<"没有这个方向";s.sys();goto flag;}
}
int main()
{
        System s;
        s.root1();
        s.root2();
        s.begin();
        s.map1();
        
        return 0;
}
2010-12-24 19:46
ash292340644
Rank: 1
来 自:重庆
等 级:新手上路
帖 子:8
专家分:4
注 册:2010-9-28
收藏
得分:1 
由于刚学C,没有遇到过这么长的程序。这个怎么运行啊?我在VC6.0上运行有个头文件找不到。
2010-12-24 21:53
木头lbj
Rank: 7Rank: 7Rank: 7
来 自:黄山
等 级:黑侠
威 望:1
帖 子:269
专家分:527
注 册:2010-11-6
收藏
得分:1 
编译成功了么?

。。。!!!)))000
2010-12-24 22:29
zwcwu
Rank: 2
等 级:论坛游民
帖 子:23
专家分:14
注 册:2010-12-24
收藏
得分:0 
回复 8楼 木头lbj
直接到vc6上就行了
2010-12-24 22:39
zwcwu
Rank: 2
等 级:论坛游民
帖 子:23
专家分:14
注 册:2010-12-24
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册
这个是图片附件在这,vc编译环境,记得要回复额
10计科班张文长游戏.zip (11.69 KB)


[ 本帖最后由 zwcwu 于 2010-12-29 13:09 编辑 ]
2010-12-24 22:42
快速回复:(大家看看)花了一个礼拜编的一个 (小游戏)vc环境
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.042752 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved