C++#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
char q,w,e;
char p;
int x=0,y;
int yao=3,coin=0;
int z=10000,dz;
int g=0,ji=0,shui=0,el=0,hu=0,tt=0,t1=0,t2=0,t3=0,t4=0,t5=0,xiao=0,da=0,bao=0,hui=0,sw=0,bu=0;
int main()
{
MessageBox(NULL,"D和A控制前后,E用道具,Q商城,F回城,空格帮助","按键设置",MB_OK+100);
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<"§§§§§§§§§§§§§§§§§§史氏游戏§§§§§§§§§§§§§§§§§§"<<endl;
p=getch();
system("cls");
cout<<"冒险"<<endl;
p=getch();
system("cls");
Sleep(500);
system("color 70");
Sleep(500);
s:if(x%10==0)
{
if(x==10||x==-10)
{
dz=80;
cout<<"一只小鸡向你扑来!"<<endl;
Sleep(1000);
system("cls");
if(z>dz)
{
MessageBox(NULL,"胜利!","",MB_OK+100);
coin+=100;
g++;
ji++;
system("cls");
if(y==1)
{
x++;
bu++;
}
if(y==0)
{
x--;
bu++;
}
goto s;
}
else goto d;
}
if(x==20||x==-20)
{
dz=100;
cout<<"一只水怪向你扑来!"<<endl;
Sleep(1000);
system("cls");
if(z>dz)
{
MessageBox(NULL,"胜利!","",MB_OK+100);
coin+=200;
g++;
shui++;
system("cls");
if(y==1)
{
x++;
bu++;
}
if(y==0)
{
x--;
bu++;
}
goto s;
}
else goto d;
}
if(x==30||x==-30)
{
dz=250;
cout<<"一只饿狼向你扑来!"<<endl;
Sleep(1000);
system("cls");
if(z>dz)
{
MessageBox(NULL,"胜利!","",MB_OK+100);
coin+=300;
g++;
el++;
system("cls");
if(y==1)
{
x++;
bu++;
}
if(y==0)
{
x--;
bu++;
}
goto s;
}
else goto d;
}
if(x==40||x==-40)
{
dz=500;
cout<<"一只猛虎向你扑来!"<<endl;
Sleep(1000);
system("cls");
if(z>dz)
{
MessageBox(NULL,"胜利!","",MB_OK+100);
coin+=400;
g++;
hu++;
system("cls");
if(y==1)
{
x++;
bu++;
}
if(y==0)
{
x--;
bu++;
}
goto s;
}
else goto d;
}
if(x==50||x==-50)
{
dz=1000;
cout<<"一只泰坦向你扑来!"<<endl;
Sleep(1000);
system("cls");
if(z>dz)
{
MessageBox(NULL,"胜利!","",MB_OK+100);
coin+=500;
g++;
tt++;
t1++;
system("cls");
if(y==1)
{
x++;
bu++;
}
if(y==0)
{
x--;
bu++;
}
goto s;
}
else goto d;
}
if(x==60||x==-60)
{
dz=1500;
cout<<"一只大泰坦向你扑来!"<<endl;
Sleep(1000);
system("cls");
if(z>dz)
{
MessageBox(NULL,"胜利!","",MB_OK+100);
coin+=600;
g++;
tt++;
t2++;
system("cls");
if(y==1)
{
x++;
bu++;
}
if(y==0)
{
x--;
bu++;
}
goto s;
}
else goto d;
}
if(x==70||x==-70)
{
dz=2000;
cout<<"一只巨型泰坦向你扑来!"<<endl;
Sleep(1000);
system("cls");
if(z>dz)
{
MessageBox(NULL,"胜利!","",MB_OK+100);
coin+=700;
g++;
tt++;
t3++;
system("cls");
if(y==1)
{
x++;
bu++;
}
if(y==0)
{
x--;
bu++;
}
goto s;
}
else goto d;
}
if(x==80||x==-80)
{
dz=2500;
cout<<"泰坦之王向你扑来!"<<endl;
Sleep(1000);
system("cls");
if(z>dz)
{
MessageBox(NULL,"胜利!","",MB_OK+100);
coin+=800;
g++;
tt++;
t4++;
system("cls");
if(y==1)
{
x++;
bu++;
}
if(y==0)
{
x--;
bu++;
}
goto s;
}
else goto d;
}
if(x==90||x==-90)
{
dz=3000;
cout<<"泰坦之神向你扑来!"<<endl;
Sleep(1000);
system("cls");
if(z>dz)
{
MessageBox(NULL,"胜利!","",MB_OK+100);
coin+=900;
g++;
tt++;
t5++;
system("cls");
if(y==1)
{
x++;
bu++;
}
if(y==0)
{
x--;
bu++;
}
goto s;
}
else goto d;
}
if(x==100||x==-100)
{
dz=4000;
cout<<"你走到了实验室的尽头"<<endl;
Sleep(1000);
cout<<"地面突然微微震颤"<<endl;
Sleep(1000);
cout<<"天蛛向你扑来!"<<endl;
Sleep(1000);
p=getch();
system("cls");
if(z>dz)
{
MessageBox(NULL,"胜利!","",MB_OK+100);
system("cls");
cout<<"天蛛低下了丑陋的头颅并沉入了培养液!"<<endl;
Sleep(1000);
cout<<"你突然感到实验室微微震动"<<endl;
Sleep(500);
system("color f0");
cout<<"“哐!”穹顶突然崩塌,一个伴着强烈背光出现的身影出现了!"<<endl;
Sleep(500);
cout<<"Ta······向你伸出了“触手”"<<endl;
Sleep(1000);
cout<<"天蛛骑士向你扑来!"<<endl;
Sleep(1000);
p=getch();
dz=5000;
if(z>dz)
{
system("cls");
MessageBox(NULL,"胜利!","",MB_OK+100);
cout<<"实验室在天蛛骑士机甲的爆裂中崩塌"<<endl;
Sleep(1000);
cout<<"废墟上空升起一朵蘑菇云!"<<endl;
Sleep(1000);
cout<<"而你,早已踏上归途······"<<endl;
Sleep(2000);
MessageBox(NULL,"谢谢游玩——史氏工作室出品","通关!",MB_OK+100);
l:system("cls");
cout<<"按A查看战绩,按D退出"<<endl;
p=getch();
if(p=='a')
{
system("cls");
cout<<"最终战斗力"<<z<<endl;
cout<<"杀死怪物"<<g<<"只"<<endl;
cout<<"其中:"<<endl;
cout<<"小鸡"<<ji<<"只"<<endl;
cout<<"水怪"<<shui<<"只"<<endl;
cout<<"饿狼"<<el<<"只"<<endl;
cout<<"猛虎"<<hu<<"只"<<endl;
cout<<"泰坦共"<<tt<<"只"<<endl;
cout<<"其中:"<<endl;
cout<<"普通泰坦"<<t1<<"只"<<endl;
cout<<"大泰坦"<<t2<<"只"<<endl;
cout<<"巨型泰坦"<<t3<<"只"<<endl;
cout<<"泰坦之王"<<t4<<"只"<<endl;
cout<<"泰坦之神"<<t5<<"只"<<endl;
cout<<"战力大于天蛛"<<z-4000<<endl;
cout<<"战力大于天蛛骑士"<<z-5000<<endl;
cout<<"剩余"<<coin<<"金币"<<endl;
cout<<"买了"<<xiao<<"把小刀"<<endl;
cout<<"买了"<<da<<"把大刀"<<endl;
cout<<"买了"<<bao<<"把宝刀"<<endl;
cout<<"剩余"<<yao<<"瓶肾上腺素"<<endl;
cout<<"回了"<<hui<<"次城"<<endl;
cout<<"死了"<<sw<<"次"<<endl;
cout<<"走了"<<bu<<"步"<<endl;
system("pause");
goto l;
}
else return 0;
}
else goto d;
}
else goto d;
}
}
system("cls");
cout<<"战斗力:"<<z<<" 金币:"<<coin<<endl;
cout<<"位置:"<<x;
if(x>=0&&x<10||x<0&&x>-10)
{
system("color 0f");
cout<<"(主城)"<<endl;
}
if(x>10&&x<20||x<-10&&x>-20)
{
system("color 97");
cout<<"(护城河)"<<endl;
}
if(x>20&&x<30||x<-20&&x>-30)
{
system("color 2f");
cout<<"(城郊)"<<endl;
}
if(x>30&&x<40||x<-30&&x>-40)
{
system("color 8f");
cout<<"(山区)"<<endl;
}
if(x>40&&x<50||x<-40&&x>-50)
{
system("color 37");
cout<<"(丛林)"<<endl;
}
if(x>50&&x<90||x<-50&&x>-90)
{
system("color e1");
cout<<"(茫茫沙漠)"<<endl;
}
if(x>90||x<-90)
{
system("color c0");
cout<<"(秘密实验室)"<<endl;
}
q=getch();
Sleep(100);
system("cls");
if(q=='a')
{
x--;
y=0;
bu++;
goto s;
}
if(q=='d')
{
x++;
y=1;
bu++;
goto s;
}
if(q=='e')
{
if(yao>0)
{
yao--;
z+=20;
cout<<"你加了20战斗力!"<<endl;
if(z>2000)
{
z=2000;
Sleep(1000);
goto s;
}
Sleep(1000);
goto s;
}
if(yao==0)
{
cout<<"你没激素了!"<<endl;
Sleep(1000);
goto s;
}
}
m:if(q=='q')
{
system("cls");
cout<<"买什么?"<<endl;
cout<<"Q:肾上腺素(100块)"<<endl;
cout<<"W:武器"<<endl;
cout<<"E:返回"<<endl;
w=getch();
if(w=='q')
{
if(coin>=100)
{
system("cls");
coin-=100;
yao++;
cout<<"你买了瓶激素!"<<endl;
Sleep(1000);
goto m;
}
else
{
system("cls");
cout<<"你买不起!"<<endl;
Sleep(1000);
goto s;
}
}
if(w=='w')
{
system("cls");
cout<<"买什么?"<<endl;
cout<<"Q:小刀(500块),50战力"<<endl;
cout<<"W:大刀(1000块),100战力"<<endl;
cout<<"E:宝刀(2000块),200战力"<<endl;
cout<<"R:返回"<<endl;
e=getch();
if(e=='q'&&coin>=500)
{
system("cls");
coin-=500;
z+=50;
xiao++;
cout<<"你买了把小刀!"<<endl;
Sleep(1000);
goto s;
}
if(e=='w'&&coin>=1000)
{
system("cls");
coin-=1000;
z+=100;
da++;
cout<<"你买了把大刀!"<<endl;
Sleep(1000);
goto s;
}
if(e=='e'&&coin>=2000)
{
system("cls");
coin-=2000;
z+=200;
bao++;
cout<<"你买了把宝刀!"<<endl;
Sleep(1000);
goto s;
}
else goto s;
}
else goto s;
}
if(q=='f')
{
cout<<"回城中8......";
Sleep(1000);
system("cls");
cout<<"7......";
Sleep(1000);
system("cls");
cout<<"6......";
Sleep(1000);
system("cls");
cout<<"5......";
Sleep(1000);
system("cls");
cout<<"4......";
Sleep(1000);
system("cls");
cout<<"3......";
Sleep(1000);
system("cls");
cout<<"2......";
Sleep(1000);
system("cls");
cout<<"1......";
Sleep(1000);
hui++;
x=0;
goto s;
}
if(q==' ')
{
MessageBox(NULL,"D和A控制前后,E用道具,Q商城,J普攻,空格帮助","帮 助",MB_OK+32);
goto s;
}
else goto s;
d:system("cls");
MessageBox(NULL,"死亡!金币归零!!!","",MB_OK+100);
coin=0;
x=0;
sw++;
goto s;
}