#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#define s Sleep(800);
using namespace std;
int live=5,strength=5;
string bag[100];
int bagi;
void village()
{
system("cls");
cout<<"1、村庄任务"<<endl;
cout<<"2、寻找村庄失踪人(未开放)"<<endl;
cout<<"3、打村庄封印怪(未开放)"<<endl;
cout<<"其他:走出村庄"<<endl;
char bbb;
bbb=getch();
if(bbb=='1')
{
while(1)
{
system("cls");
cout<<"1、帮助村民捕三条鱼——3点体力值"<<endl;
cout<<"其他:退出"<<endl;
char cc;
cc=getch();
if(cc=='1')
{
int ge=0;
while(1)
{
system("cls");
cout<<"地点:河流(番外篇)"<<endl;
cout<<"1、捞网 其他:退出"<<endl;
char fish;
fish=getch();
if(fish=='1')
{
int catch_or_not=rand()%100;
if(catch_or_not<33)
{
cout<<"你捞到了一条鱼"<<endl;
ge++;
}
else
{
cout<<"鱼跑了。"<<endl;
}
cout<<"按任意键继续";
char cccc;
cccc=getch();
}
else
{
break;
}
}
if(ge>=3)
{
cout<<"恭喜您完成任务!"<<endl;
strength+=3;
cout<<"按任意键继续";
char dddd;
dddd=getch();
}
}
else
{
break;
}
}
}
/*
if(bbb=='2')
{
cout<<"1、村长——+3格血"<<endl;
cout<<"2、神秘贸易员——+2格血"<<endl;
cout<<"3、律师——+1格血"<<endl;
char people;
people=getch();
while(people!='1'&&people!='2'&&people!='3')
{
cout<<"1、村长——+3格血"<<endl;
cout<<"2、神秘贸易员——+2格血"<<endl;
cout<<"3、律师——+1格血"<<endl;
people=getch();
}
if(people=='1')
{
while(1)
{
cout<<"向前:F 向后:B 向左:L 向右:R"<<endl;
char sit;
sit=getch();
while(sit!='F'&&sit!='B'&&sit!='L'&&sit!='R')
{
cout<<"向前:F 向后:B 向左:L 向右:R"<<endl;
sit=getch();
}
int cz=rand()%100;
if(sit=='F')
{
if(cz<5)
{
cout<<"恭喜你,找到了村长!!!,生命值+3"<<endl;
live+=3;
}
cout<<"按任意键继续"<<endl;
char yyds;
yyds=getch();
}
if(sit=='B')
{
if(cz<5)
{
cout<<"恭喜你,找到了村长!!!,生命值+3"<<endl;
live+=3;
}
cout<<"按任意键继续"<<endl;
char yyds;
yyds=getch();
}
if(sit=='L')
{
if(cz<5)
{
cout<<"恭喜你,找到了村长!!!,生命值+3"<<endl;
live+=3;
}
cout<<"按任意键继续"<<endl;
char yyds;
yyds=getch();
}
if(sit=='R')
{
if(cz<5)
{
cout<<"恭喜你,找到了村长!!!,生命值+3"<<endl;
live+=3;
}
cout<<"按任意键继续"<<endl;
char yyds;
yyds=getch();
}
}
}
}
if(bbb=='3')
{
}
*/
if(bbb!='1')//&&bbb!='2'&&bbb!='3')
{
return ;
}
village();
}
int main()
{
cout<<"你来得太早了,世界还没有诞生。";
Sleep(2000);
system("cls");
cout<<"不过你可以通过升维来创造属于你的世界!";
Sleep(3000);
system("cls");
cout<<"地点:零维初始"<<endl;
Sleep(1000);
cout<<"按任意键升维";
char zero=getch();
cout<<endl;
cout<<"升维中";
cout<<"·";
s;
cout<<"·";
s;
cout<<"·";
s;
cout<<"·";
s;
cout<<"·";
s;
cout<<"·";
system("cls");
int banana=0;
while(live>0)
{
if(banana>=5)
{
cout<<"您的腐烂的香蕉已够5个,可以进行升维。"<<endl;
cout<<"按任意键升维";
char one;
one=getch();
cout<<endl;
cout<<"升维中";
cout<<"·";
s;
cout<<"·";
s;
cout<<"·";
s;
cout<<"·";
s;
cout<<"·";
s;
cout<<"·";
system("cls");
break;
}
cout<<"地点:一维森林"<<endl;
cout<<"腐烂的香蕉:"<<banana<<endl;
cout<<"生命值:"<<live<<endl;
cout<<"体力值:"<<strength<<endl;
cout<<"向左:L 向右:R"<<endl;
char dir;
dir=getch();
while(dir!='L'&&dir!='R')
{
cout<<"向左:L 向右:R"<<endl;
dir=getch();
}
if(dir=='L')
{
int k=rand()%100;
if(k<=20)
{
cout<<"恭喜你找到了一个腐烂的香蕉!!!"<<endl;
banana+=1;
cout<<"按任意键继续";
zero=getch();
system("cls");
continue;
}
if(k<50&&k>20)
{
cout<<"你遇到了一个红色的东西,看起来很好吃。"<<endl;
cout<<"1、吃 2、不吃";
char eat;
eat=getch();
cout<<endl;
int temp=rand()%100;
if(eat=='1')
{
if(temp<50)
{
cout<<"你吃掉了一个娜迦毒蛇辣椒。你被辣的不行不行的了。体力值-3"<<endl;
strength-=3;
}
else
{
cout<<"你吃掉了一个草莓,生命值+1"<<endl;
live+=1;
}
}
else
{
if(temp<50)
{
cout<<"那其实是一个娜迦毒蛇辣椒,吃了会体力值-3。"<<endl;
}
else
{
cout<<"那其实是一个草莓,吃了会生命值+1"<<endl;
}
}
}
if(strength<=0)
{
live--;
strength=5;
}
if(k>=50)
{
cout<<"你遇到了一个苹果,看起来很美味。"<<endl;
cout<<"1、吃 2、不吃";
char eat;
eat=getch();
cout<<endl;
int du_or_hui=rand()%100;
if(eat=='1')
{
if(du_or_hui<50)
{
cout<<"你吃到了一个苹果,生命值+1"<<endl;
live+=1;
}
else
{
cout<<"你吃到了一个毒苹果,体力值-2"<<endl;
strength-=2;
}
}
else
{
if(du_or_hui<50)
{
cout<<"那其实是一个苹果,吃了会生命值+1"<<endl;
}
else
{
cout<<"那其实是一个毒苹果,吃了会生命值-2"<<endl;
}
}
}
if(strength<=0)
{
live--;
strength=5;
}
cout<<"按任意键继续";
char rrr;
rrr=getch();
system("cls");
}
else
{
int k=rand()%100;
if(k<=20)
{
cout<<"恭喜你找到了一个腐烂的香蕉!!!"<<endl;
banana+=1;
cout<<"按任意键继续";
zero=getch();
continue;
}
if(k<50&&k>20)
{
cout<<"你遇到了一个绿色的东西,看起来很好吃。"<<endl;
cout<<"1、吃 2、不吃";
char eat;
eat=getch();
cout<<endl;
int temp1=rand()%100;
if(eat=='1')
{
if(temp1<50)
{
cout<<"你吃掉了一个毒苹果。体力值-2"<<endl;
strength-=2;
}
else
{
cout<<"你吃掉了一盆蔬菜沙拉,体力值+3"<<endl;
strength+=3;
}
}
else
{
if(temp1<50)
{
cout<<"那其实是一个毒苹果,吃了会体力值-2。"<<endl;
}
else
{
cout<<"那其实是一盆蔬菜沙拉,吃了会体力值+3"<<endl;
}
}
}
if(strength<=0)
{
live--;
strength=5;
}
if(k>=50)
{
cout<<"你遇到了一个紫色的生物,看起来很鲜艳。"<<endl;
cout<<"1、吃/闻 2、不吃/不闻";
char eat;
eat=getch();
cout<<endl;
int du_or_hui=rand()%100;
if(eat=='1')
{
if(du_or_hui<50)
{
cout<<"你吃到了一个葡萄,生命值+1"<<endl;
live+=1;
}
else
{
cout<<"你闻了曼陀罗,这是一种剧毒生物,体力值-2"<<endl;
strength-=2;
}
}
else
{
cout<<"那其实是一个";
if(du_or_hui<50)
{
cout<<"葡萄,吃了会生命值+1"<<endl;
}
else
{
cout<<"曼陀罗,这是一种剧毒生物,闻了会体力值-2"<<endl;
}
}
}
if(strength<=0)
{
live--;
strength=5;
}
cout<<"按任意键继续";
char rrr;
rrr=getch();
system("cls");
}
}
if(live<=0)
{
cout<<"你";
s;
cout<<"死";
s;
cout<<"了";
s;
cout<<"!";
}
else
{
int cactus=0,g=0;
while(live>0)
{
if(cactus==5)
{
cout<<"您的铜仙人掌已够5个,可以进行升维。"<<endl;
cout<<"按任意键升维";
char two;
two=getch();
cout<<endl;
cout<<"升维中";
cout<<"·";
s;
cout<<"·";
s;
cout<<"·";
s;
cout<<"·";
s;
cout<<"·";
s;
cout<<"·";
system("cls");
break;
}
cout<<"地点:二维沙漠"<<endl;
cout<<"铜仙人掌:"<<cactus<<endl;
cout<<"生命值:"<<live<<endl;
cout<<"体力值:"<<strength<<endl;
cout<<"前:F 后:B 左:L 右:R"<<endl;
char move1;
move1=getch();
while(move1!='F'&&move1!='B'&&move1!='L'&&move1!='R')
{
cout<<"前:F 后:B 左:L 右:R"<<endl;
move1=getch();
}
g++;
int situa=rand()%100;
if(situa<15)
{
cout<<"恭喜你找到了一个铜仙人掌"<<endl;
cactus++;
cout<<"按任意键继续";
char gggg;
gggg=getch();
system("cls");
}
if(situa>=15&&situa<30)
{
cout<<"你找到一个村庄。"<<endl;
cout<<"按任意键继续";
zero=getch();
village();
system("cls");
}
if(situa>=30&&situa<65)
{
cout<<"你遇到了一片湖泊"<<endl;
cout<<"1、喝 2、不喝"<<endl;
char d_or_not;
d_or_not=getch();
int du_or_yi=rand()%100;
if(d_or_not=='1')
{
if(du_or_yi<50)
{
cout<<"你中毒了,掉了2格血。"<<endl;
live-=2;
}
else
{
cout<<"你喝了有益之水,生命值+1。"<<endl;
live++;
}
}
else
{
if(d_or_not<50)
{
cout<<"那其实是有毒之水,喝了会掉2格血。"<<endl;
}
else
{
cout<<"那其实是有益之水,喝了会生命值+1"<<endl;
}
}
if(strength<=0)
{
live--;
strength=5;
}
cout<<"按任意键继续";
char aaa;
aaa=getch();
system("cls");
}
if(situa>=65)
{
cout<<"你遇到了一个骆驼,杀死后可获得骆驼肉";
cout<<endl;
cout<<"1、攻击 2、走开"<<endl;
char a_or_go;
a_or_go=getch();
if(a_or_go=='1')
{
int Elive=20;
while(Elive>0)
{
cout<<"1、攻击 2、走开"<<endl;
char attack;
attack=getch();
if(attack=='2')
{
break;
}
cout<<endl<<"你攻击了骆驼,骆驼掉了5格血"<<endl;
Elive-=5;
}
if(Elive<=0)
{
cout<<"恭喜你打败了骆驼,获得了骆驼肉。"<<endl<<"1、吃 2、不吃(放背包里)"<<endl;
char eat;
eat=getch();
if(eat=='1')
{
cout<<"你吃了骆驼肉,生命值+3";
live+=3;
system("cls");
}
else
{
cout<<"已放入背包"<<endl;
bag[bagi]="骆驼肉";
cout<<"1、查看 其他:退出"<<endl;
char check;
check=getch();
bagi++;
if(check=='1')
{
for(int i=0;i<bagi;i++)
{
cout<<bag[i]<<endl;
}
}
cout<<"按任意键继续";
char stgj;
stgj=getch();
system("cls");
}
}
}
}
if(g>=3)
{
g=0;
strength--;
}
if(strength<=0)
{
live--;
strength=5;
}
}
}
if(live<=0)
{
cout<<"你";
s;
cout<<"死";
s;
cout<<"了";
s;
cout<<"!";
}
else
{
int dragon_egg=0;
while(live>0)
{
cout<<"地点:三维侏罗纪"<<endl;
cout<<"银龙蛋:"<<dragon_egg<<endl;
cout<<"生命值:"<<live<<endl;
cout<<"体力值:"<<strength<<endl;
}
}
return 0;
}
如果觉得《1.1 C++小游戏——创造世界》对你有帮助,请点赞、收藏,并留下你的观点哦!