C++制作生存小游戏

#include<bits/stdc++.h>
#include<Windows.h>
#include<conio.h>
#include<ctime>
#define mm1 700
#define mm2 1200
#define mm3 1900
using namespace std;
const long long MAXN=10000000000,MIN=2e9+1;
int fishjez[30]={0,65,40,60,90,100,85,95,75,25,25,40,60,50,45,115,70};
string gjfxx[30]={"","獠牙","利爪","笙忼术","笙电术","土玄术","战斧","法杖","易闽术","鸡汤术","篮球","易慴术","戟埕术","黑子"};
string fishing[200]={"","石斑鱼","螃蟹","条石斑","鲭鱼","鲶鱼","红鳟鱼","海鲂","小鲨鱼","海参","鳐鱼","沙丁鱼","鳕鱼","蝴蝶鱼","章鱼","秋刀鱼","罗非鱼","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""};
string cfnm[25]={"","烤肉","烤鱼","荒野烤肉","烤土豆","肉汤","土豆泥","秘制炖肉","","","","",""};
int cfjez[25]={0,85,100,120,95,135,120,150}; 
string fms[8]={"","Ⅰ","Ⅱ","Ⅲ","Ⅳ","Ⅴ"};
string dfs1[20]={"","","",""}; 
struct sc{
	int ts;
	int js;
}cfs[505];
struct o{
	int times;
	int jjes;
}fishs[1000]; 
int main(){ 
system("title 孤岛求生");
for(int i=1;i<=14;i+=1){fishs[i].jjes =fishjez[i];}
for(int i=1;i<=7;i++){cfs[i].js =cfjez[i];} 
string gjfx;int ttk=0;
    string s20;int fmt;string fucks;
    char pictures1[200][200]={
	"                                                /EEEEEEEEEEEEk  ", 
    "  /—————k              |EEEEEE|           |     卧室     | 	",
    " /  物资仓库  k             | 任务 |           |    / ---  /  | 	", 
    " |     ℡     |             | 清单 |           |   /      /   | 	",
    " |            |             |______|           | ↙|======|   | 	", 
    "                                               |   | sleep|   | 	",
    "                                               |   |      |   | 	", 
    "                                               | ↙|______|   |	",
	"                      厨房/   k                |              | 	", 
    "   __________            /_ ↑_k               |_    _________| 	", 
    "    |工作台|             。。。。                               	", 
    "    |      |          =============                             	",
    "                                                                	", 
    "                                                                	",
    "         医药台                                                 	", 
    "      k     / ______                           ________	     	",
    "       |_+_|  | -- |                           |      |		 	", 
    "        / l   | <> |                           | 出门 |		    ",
    "                                               |  ℡  |		    ",
	"|__|__|__|__|__|__|__|__|__|__|__|__|__|__|__|_|      |__|__|__|__|_",
    "|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | |      |  |  |  |  | ",
	};
	char pictures2[200][200]={ 
	"                                                                    ",
	"                         .  ..     .         |      | 3,世纪峡谷    ",
	"                       . ..     .            |      |___*0----      ",
	"                        .     .              |      |               ",
	"      1,绿色平原          2,丘陵             |      |      		 ",
	"      _      _                               |  R   |            	 ",
	"       |____|                                |  I    K              ",	
	"                                             |  V    |              ",	
	"                                             |  E    |     15,    	 ",
	"              10,篮球场                      |  R   /    隐藏矿洞 _ ",
	"                ———          回家         |      |            |_|",
	"               |+ 0 +|         |------|      |      |               ",
	"                ———         |0,home|      /      |               ",
	"                               |———|     |  桥  /                ",
	"                                        ___/|======|k_              ",
	"                                        ___/|======|K_              ",
	"                                            |      |                ",
	"       5,黑暗森林       6,部落             /       |                ", 
	"       [  , + , ]          /              /       /                 ",
	"       ~~  , , ~~       ---              /    |  /                  ",
	"        |   |  |         /              /4,瀑布 /        -          ",
	"                     7,尸村   _________/       /        / J         ",
	"                            /             |   /        /   J        ",
	"                          _/                _/        |     |       ",
	"                         /       __________/           9,远山       ",
	"      14,               /   港  /                                   ",
	"     松林               |  湾  |                                    ", 
	"   ↑↑↑↑            /       |   11,      12,          13,        ",
	"           __________/         | 山顶洞  大山顶洞    超大的山顶洞   ",
	"       ___/     沉船           /    -     -----      -------------- ",
	"      /      l----------/     /    | |   |     |    |              |",
	"     /         l--------/    |      -     -----      -------------- ",
	}; 
	char pictures3[80][80]={
	"                                            __                 ",
	"                                  -------/  |                  ",
	"                                  ------/|  |  钓鱼码头        ",
	"                                  -------|  J                  ",
	"  回家                                                         ",
	"      ___                                                      ",
	"    __|_|__                                                    ",
	"   /  HOME k                                                   ",
	"  /    _    k                种植园                            ",
	"  |   | |   |              +++++++++++                         ",
	"  |___|_|___|              +---------+                         ",
	"                           +---------+               野        ",
	"                           +++++++++++                         ",
	"                                                               ",
	"                                                     外        ",
	"                  ________                                     ",
	"                 |________|                                    ",
	"               ____|____|___                                   ",
	"                |  郊区   |                                    ",
	"                |   商店  |                                    ",
	"                |_________|                                    ",
	}; 
int k10=0;string sb0="欢迎游玩本游戏",sb1="欢迎来到 坤坤岛",sb2="据传说,这荒岛危机四伏,你可要想方设法的生存下去,并逃出这里!";
    for(int i=0;i<=sb0.size()-1;i++){
        cout<<sb0[i];
        Beep(mm3,45);Sleep(13);}   
    Sleep(620);Beep(mm3,60);
    cout<<endl<<"     请输入游戏机的密码(6位):" ; Sleep(600);system("cls");   
    char hhhh;string qa;
    cout<<"\n\n         0   1   2\n\n";
    cout<<"         3   4   5\n\n";
   	cout<<"         6   7   8\n\n";
    cout<<"         坤  9  坤";
    for(int i=1;;i++){
        hhhh=_getch();qa+=hhhh;system("cls");cout<<"\n\n        "; 
        for(int mt=1;mt<=i%6;mt++){cout<<"·";}
    	cout<<"\n\n         0   1   2\n\n";
    	cout<<"         3   4   5\n\n";
   		cout<<"         6   7   8\n\n";
    	cout<<"         坤  9  坤";	
        if(i%6==0)
        {Sleep(130);
        	if(qa=="123456"){cout<<"\n          密码正确!"<<endl;Beep(mm2,201);break; }
        	cout<<"\n          密码错误    ";Beep(mm1,500);
        	if(i>1){cout<<"已尝试"<<k10<<"次"<<endl;}k10+=1;
			if(i==8){cout<<"\n";for(int i=1;i<=6;i+=1){Sleep(499);cout<<i;}cout<<"\n";Sleep(555);break;} 
			qa="";system("cls"); 
		cout<<"\n\n         0   1   2\n\n";
    	cout<<"         3   4   5\n\n";
   		cout<<"         6   7   8\n\n";
    	cout<<"         坤  9  坤";
		}
        
	}  
		while(2){
        long long zidan=0;
//木材cll1  藤条cll2  棕榈叶cll3  铁锭cll4  石片cll5  青金石cll6  钢铁cll7 
//生肉sc1  土豆sc2   淡水sc3  蜂蜜sc4   
int cl7=0,ml1=0,ml2=0,tl1=0,tl2=0,tl3=0,tl4=0,tl5=0,tl6=0,tl7=0,plof=0;
short sc1=0,sc2=0,sc3=0,sc4=0,sc5=0,sc6=0,sc7=0; 
int tian20=1,tian21=1,tian22=1;
int zz1=0,zz2=2,zz3=2;
int cll1[49]={0,3,2,10,3,2,5,12,20,0,2,4,6,5,1,1,0,0,1,0,0,0,4,0,0,2,500,5,0,0,10,100,0,0,10,10};
int cll2[49]={0,0,10,15,0,2,3,5,12,0,0,3,4,3,5,30,5,0,0,0,1,0,0,0,0,1,0,7,0,40,0,100,0,0,50,0};  
int cll3[49]={0,3,0,15,2,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,2,0,0,10,50,100,80,200,0};
int cll4[49]={0,0,1,7,0,0,0,0,4,0,0,0,2,0,0,0,20,1,1,1,1,5,0,0,2,4,500,0,4,0,0,0,0,0,100,5};  
int cll5[49]={0,0,0,0,1,0,0,2,0,2,3,0,1,0,10,0,5,0,0,0,0,0,0,0,0,0,0,5,0,20,0,0,30,0,0,0};
int jnj[40]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};  
int hs[10]={0,0,0},hss[10]={0,0,0};
int j11[40]={0,1,2,4,6,10,15,20,60,150,151};
int j12[40]={0,7,15,25,50,100,220,340,1314,3000,250250,857857,22222,53453};
int j13[40]={0,25,50,90,175,220,350,700,1100,4500,3838,3838438,43553,114514};
int linjian[40]={0,0,0,0,0,0};
int jjjb[20]={0,7,12,30,50,80,300,520,700,2500,3830,413,131,3123};
int ve[20]={0,12,12,12};string fz[30]={"","野猪","毒腥","吞噬","火电","咀骨","僵尸","协增","黑子","长臂","召唤","黄眸","蛛形","鸡王"};
int gjs[30]={0,2,3,2,7,10,12,19,31,54,92,8,15,100},xls[30]={0,15,21,70,40,82,100,120,200,2423,104664,5436,3665,200};
int jjjj[20]={0,10,14,5,32,47,69,105,180,350,1000,20,35,1500};
string ssss[30]={"","小野猪","小狮子","小鳄龟","成年狼","土蜥蜴","野人酋长","森林巨人","人物0","钏姍钾","蔡虚坤","悲伤的人物1","快乐的人物2","忧郁的人物3"};
int xxxx[20]={0,160,220,700,340,470,600,1000,1700,20000,500000,114514,20005,1231};
int jbs[40]={0,90,15,120,220,400,550,300,1,8,1,10,35,40,20,400,500,1300,1800,10000,25000};
string sss[20]={"","绿色平原","沙漠丘陵","世纪峡谷","死亡瀑布","黑暗森林","野人部落","僵尸村落","沉船","远山","废弃的篮球场","山顶洞","大山顶洞","超大的山顶洞"};
int fmtj=0,fmtj2=0,fmtj3=0;int jl=150;
int uxl;int fy=0;int cl6=0;string dfs,dfs2; int ppm,ppm2;
int max1=0,max2=0;int zxc=0;int yd;int uyu;string ugg="当你坐上火箭,进入那广阔无垠的星空时,你意识到游戏胜利了"; 
long long q=0,am=0,cnt=0,sb=0,gj=0,xl=0,x1,t=0,bx1,sr,mjj,ll=8,sdd=0,gh=0,s5=0,s6=0,s7,s11=0,s12=0,s13,v,ti=15,yy=0,akm=0,ab=444,z,jj,n=0,x=0,y=100;
string s1,s2,s8,s9,s10,hj,s20;int k,gb,nd,yp,ugb=15,jxl=0,bd=0,jjb=0,sx=150,gsx=0,ggb=0,js=0,yls=0,ujy=0,jjy=0,jysx=100,dg=1,km=520,gm;int jm=20,jm2=5,io,cntm=100;string s45;
int njz=0,aqw=10;int akl=0,qwz=0,step,stepisSB,stepisverySB,lmk;int nm;int pl=0,srs=0; bool tm1=0,tm2=0,tm3=0,tm4=0,tm5=0;int cl1=2,cl2=2,cl3=2,cl4=0,cl5=0;int p1=0,p2=100,pdg=1;int tian=0,shi=8,fen=0; int rw1=0,rw11=0,rw2=0,rw21=0,rw3=0,rw31=0,rw4=0,rw41=0,rw51=0,rw61=0,rw7=0,rw71=0,rw8,rw81=0,rw9=0,rw91=0,rwa=0,rwa1=0,rwb=0,rwb1=0,rwc=0,rwc1=0,rwd=0,rwd1=0;
int et=0,jgj=0,jez=220,jezsx=220,sp1=1,sp2=1,sp3=0,jsp=0,sk12,cmk=180;
char amy[100][100];int k10=1; long long u;bool han=0;x1=5; int tm9=0;
uxl=150;sx=150;fmtj=fmtj2=fmtj3=0;int wsz=200,nsz=200,wszsx=200,nszsx=200;
        s1="空手"; 
        for(int i=0;i<=sb1.size()-1;i++){
            cout<<sb1[i];Beep(mm3,45);Sleep(17);}
        Sleep(777);cout<<endl;
         cout<<"先创建一下你的名称(15个字符/汉字以内):";
        cin>>s20; 
        if(s20=="坤"){
            jl=120;uxl=140
  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
#include<bits/stdc++.h> #include<windows.h> using namespace std; int choice; int a=0,b=0,c=0,d=0; int user_input; void S(int Color) { HANDLE hCon=GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hCon,Color); } void wait() { Sleep(100); user_input=getchar(); } void cls() { Sleep(100); system("cls"); } int main(int argc, char *argv[]) { S(172); start:cls(); goto a1; gameover:printf("游戏结束。"); printf("按回车键继续"); user_input=getchar(); goto start; a1:printf("现在游戏开始。"); user_input=getchar(); printf("一天,你正在开飞机经过一片雪山区。"); wait(); printf("忽然你的操作系统失控了,飞机直直地坠入山中。"); wait(); printf("你朝两旁看了看,左边是雪地,右边是树林。而你正前方是悬崖,所以你不得不转弯。\n1-左转。\n2-右转。\n"); s1:wait(); switch(user_input) { case'1':goto a8; case'2':goto a13; default:goto s1; } a2:cls(); printf("你下了飞机,走向树林。"); wait(); printf("过了一会儿,你感到又饿又冷,就喝了一点威士忌,坐下休息。"); wait(); printf("但是,威士忌并没有让你觉得温暖。你只是觉得很冷、很冷。\n"); goto gameover; a3:cls(); printf("你吃了一些果实,还摘了一些放在口袋,想晚一点吃。"); wait(); printf("过了一会儿,你的肚子剧烈的痛起来。这时,你才意识到,果子有毒!\n"); goto gameover; a4:cls(); printf("你是否要继续往隧道里走?\n1-是。\n2-不了。\n"); s4:wait(); switch(user_input) { case'1':goto a18; case'2':goto a22; default:goto s4; } a5:cls(); printf("你能带三件东西下飞机。请选择:\n1-香蕉、打火机、外套。\n2-威士忌、外套、匕首。\n"); s5:wait(); switch(user_input) { case'1':goto a10; case'2':goto a2; default:goto s5; } a6:cls(); printf("你走到了隧道里,隧道里很黑,忽然你被一个东西绊倒了。\n"); wait(); printf("你爬起来,看了看地上的东西,原来是一条麻绳。\n1-捡起来。\n2-置之不理。\n"); s6:wait(); switch(user_input) { case'1':goto a11; case'2':goto a23; default:goto s6; } a7:cls(); printf("你呆在飞机里,感到越来越冷,你不得不离开了飞机。\n"); goto a5; a8:cls(); printf("随着“噗”地一声闷响,你的飞机安全降落在雪地上。"); wait(); printf("你要离开飞机去找东西吗?\n1-离开。\n2-待着。\n"); s8:wait(); switch(user_input) { case'1':goto a5; case'2':goto a7; default:goto s8; } a9:cls(); printf("你走出了隧道,继续走。\n"); wait(); printf("你来到了一个山谷前。"); wait(); printf("要走过去吗?\n1-走。\n2-不走。\n"); s9:wait(); switch(user_input) { case'1':goto a17; case'2':goto a12; default:goto s9; } a10:cls(); printf("你下了飞机,漫无目的地寻找食物。\n"); wait(); printf("你看到了一棵树,树上结着一种你从未见过的果子。\n1-吃一点。\n2-离开。\n"); s10:wait(); switch(user_input) { case'1':goto a3; case'2':goto a15; default:goto s10; } a11:cls(); printf("你捡起了绳子,发现它很长。"); a++; wait(); wait(); goto a22; a12:cls(); printf("你没有走进山谷,而是继续走。\n"); wait(); printf("很快,你就因饥饿死去了。\n"); wait(); goto gameover; a13:cls(); printf("“轰”,你的飞机撞上了树,爆炸了。"); wait(); goto gameover; a14:cls(); printf("你追着飞机跑。但是,飞机比你快太多了,你没有追上。"); wait(); printf("你很累很累,倒在了地上。"); wait(); printf("你死于虚脱。\n"); wait(); goto gameover; a15:cls(); printf("你没有吃果子,而是继续走。你走了很久,来到一个隧道口。\n1-进去。\n2-不进去。\n"); s15:wait(); switch(user_input) { case'1':goto a6; case'2':goto a21; default:goto s15; } a16:cls(); printf("你捞起了很多鱼,找了些树枝,烤了鱼来吃。"); wait(); printf("你觉得好多了。"); wait(); printf("这时,天空中传来嗡嗡的响声。你抬头一看,有飞机!\n1-追着飞机跑。\n2-点篝火。\n"); s16:wait(); switch(user_input) { case'1':goto a14; case'2':goto a20; default:goto s16; } a17:cls(); printf("你走了很久,有些体力不支,于是你把香蕉吃了。"); wait(); printf("你走了很久,来到了一个废弃矿坑边。\n1-探索一下。\n2-离开。\n"); s17:wait(); switch(user_input) { case'1':goto a24; case'2':goto a19; default:goto s17; } a18:cls(); printf("你继续往隧道里走,你感觉呼吸越来越难受。\n"); wait(); wait(); printf("你死于窒息。\n"); wait(); goto gameover; a19:cls(); printf("你来到了一个冰封的湖边。"); wait(); if(a==1) { if(b==1) { printf("你用麻绳织了个渔网,用锤子砸破冰面,试图捞上一些鱼。\n"); wait(); goto a16; } else { printf("你用麻绳织了个渔网,却无法打破冰面。你无奈地望着湖面,绝望地叹了口气。\n"); wait(); printf("你饿死了。\n"); wait(); goto gameover; } } else { if(b==1) { printf("你用锤子砸破了冰面,却没办法捞鱼。你无奈地望着湖面,绝望地叹了口气。\n"); wait(); printf("你饿死了。\n"); wait(); goto gameover; } else { printf("你很想捞鱼,却无法打破冰面,又没办法捞鱼。你无奈地望着湖面,绝望地叹了口气。\n"); wait(); printf("你饿死了。\n"); wait(); goto gameover; } } a20:cls(); printf("你找来许多木头,点燃了篝火。飞机上的人看见了浓烟,降落下来,把你救上了飞机。\n"); wait(); printf("事后,你被送去了医院治疗。\n"); printf("生存成功!\n"); wait(); goto gameover; a21:cls(); printf("你绕过了隧道,继续走。\n"); goto a9; a22:cls(); printf("你要继续走吗?\n1-是。\n2-不了。\n"); s22:wait(); switch(user_input) { case'1':goto a18; case'2':goto a9; default:goto s22; } a23:cls(); printf("你没有捡起绳子。"); wait(); wait(); goto a22; a24:cls(); printf("你找到了一把锤子。\n"); b++; wait(); wait(); goto a19; return 0; }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值