自编小Game
希望大家喜欢
awd移动,s查看状态,qe发射子弹,j攻击
#include<bits/stdc++.h>
#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
using namespace std;
int dt[35],x,y,a,b,dt2[35],hehe=-1,sl=20,dl=100,gj=-1;
char xs;
void Bl()
{
for(int i=0;i<=3;i++)
{
system("color 1A");Sleep(10);
system("color 2B");Sleep(10);
system("color 3C");Sleep(10);
system("color 4D");Sleep(10);
system("color 5D");Sleep(10);
system("color 6E");Sleep(10);
system("color 7F");Sleep(10);
}
system("color 0F");system("cls");
}
void Color(int a)
{
if(a==0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
if(a==5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
if(a==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN);
if(a==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==9) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
if(a==10) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|BACKGROUND_GREEN);
if(a==11) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE|BACKGROUND_GREEN);
if(a==12) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|BACKGROUND_GREEN);
if(a==13) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|BACKGROUND_INTENSITY|BACKGROUND_BLUE);
if(a==14) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|BACKGROUND_INTENSITY|BACKGROUND_RED);
}
void out(string a)
{
int l=a.length();
for(int i=0;i<l;i++)
{
cout<<a[i];
Sleep(10);
}
cout<<endl;
}
void gotoxy(int x, int y)
{
COORD coord;
HANDLE hscr;
coord.X=x;
coord.Y=y;
hscr=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hscr, coord);
}
void meng()
{
out("_______________meng_____________");
out("_______________bank_____________");
out("+------+--###+------+-----###");
out("+------+ ## ##+------++--## ##");
out("+------+## ##+------+ ## ##");
out("+------## ##+------## ##");
out("+-----## ##+---## ##");
out("+----## ##+ ## ##");
out("+---## ## ##");
out("+--## ## ##");
out("+-## ## ##");
out("### ## ###");
out("_______________________________");
out("_______孟银行__________________");
}
void qp()
{
Sleep(100);
system("cls");
}
void pt(int x,int i)
{
if(x==0)
{
cout<<setw(i*4+3)<<" "<<endl;
cout<<setw(i*4+3)<<" "<<endl;
cout<<setw(i*4+3)<<" "<<endl;
}
if(x==1)
{
cout<<setw(i*4+3)<<" o"<<endl;
cout<<setw(i*4+3)<<"-|-"<<endl;
cout<<setw(i*4+3)<<"||"<<endl;
}
else if(x==2)
{
cout<<setw(i*4+5)<<" o__"<<endl;
cout<<setw(i*4+3)<<"/|"<<endl;
cout<<setw(i*4+3)<<"/)"<<endl;
}
else if(x==3)
{ cout<<setw(i*4+2)<<" o"<<endl;
cout<<setw(i*4+3)<<"/|__"<<endl;
cout<<setw(i*4+1)<<"/"<<endl;
}
else if(x==4)
{
cout<<setw(i*4+2)<<"_o_"<<endl;
cout<<setw(i*4+3)<<"|_"<<endl;
cout<<setw(i*4+1)<<"|"<<endl;
}
else if(x==5)
{
cout<<setw(i*4+3)<<"_^_"<<endl;
cout<<setw(i*4+3)<<"|||"<<endl;
cout<<setw(i*4+3)<<"___"<<endl;
}
if(x==9)
{
Color(4);
cout<<setw(i*4+3)<<") "<<endl;
cout<<setw(i*4+3)<<">"<<endl;
cout<<setw(i*4+3)<<") "<<endl;
Color(8);
}
if(x==10)
{
Color(4);
cout<<setw(i*4+3)<<" ("<<endl;
cout<<setw(i*4+3)<<"<"<<endl;
cout<<setw(i*4+3)<<" ("<<endl;
Color(8);
}
if(x>=11&&x<=16)
{
Color(4);
cout<<setw(i*4+2)<<"■■"<<endl;
cout<<setw(i*4+3)<<"■■"<<endl;
cout<<setw(i*4+1)<<"■■"<<endl;
Color(8);
}
if(x==17)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 6);
cout<<setw(i*4+4)<<" ■"<<endl;
cout<<setw(i*4+4)<<"■"<<endl;
cout<<setw(i*4+4)<<"■"<<endl;
Color(8);
}
if(x==18)
{
if(rand()%2==1)
{cout<<setw(i*4+3)<<" o"<<endl;
cout<<setw(i*4+3)<<"/|)"<<endl;
cout<<setw(i*4+3)<<"╯>"<<endl;
}
else
{
cout<<setw(i*4+3)<<" o"<<endl;
cout<<setw(i*4+3)<<"/|)"<<endl;
cout<<setw(i*4+3)<<"┦"<<endl;
}
}
if(x==19)
{
Color(12);
cout<<setw(i*4+3)<<"000"<<endl;
cout<<setw(i*4+3)<<"<|>"<<endl;
cout<<setw(i*4+3)<<"<>"<<endl;
Color(8);
}
if(x==20)
{
Color(13);
cout<<setw(i*4+3)<<"■■"<<endl;
cout<<setw(i*4+3)<<"■"<<endl;
cout<<setw(i*4+3)<<"■■"<<endl;
Color(8);
}
if(x==21)
{
Color(11);
cout<<setw(i*4+3)<<" /|"<<endl;
cout<<setw(i*4+3)<<"<||>"<<endl;
cout<<setw(i*4+3)<<" |/'"<<endl;
Color(8);
}
if(x==22)
{
Color(14);
cout<<setw(i*4+3)<<" ()"<<endl;
cout<<setw(i*4+3)<<"/||)"<<endl;
cout<<setw(i*4+3)<<"____'"<<endl;
Color(8);
}
if(x==23)
{
Color(13);
cout<<setw(i*4+3)<<" ^"<<endl;
cout<<setw(i*4+3)<<"/**)"<<endl;
cout<<setw(i*4+3)<<"____'"<<endl;
Color(8);
}
if(x==24)
{
if(rand()%4+1==1) Color(8);
else if(rand()%3+1==1) Color(11);
else if(rand()%2+1==1) Color(14);
else Color(13);
cout<<setw(i*4+3)<<" (|)"<<endl;
cout<<setw(i*4+3)<<"-<>-"<<endl;
cout<<setw(i*4+3)<<"::::"<<endl;
Color(8);
}
}
void zt()
{
system("cls");
cout<<"你:";
for(int i=1;i<=sl;i++)
cout<<"■";
cout<<endl;
cout<<"敌:";
for(int i=1;i<=dl;i++)
cout<<"■";
out("按任意键返回");
for(;;)
if(kbhit())
{
system("cls");
return;
}
}
void hf(int k)
{
sl=20,dl=100;
for(int i=1;i<=29;i++)
dt[i]=0;
for(int i=1;i<=29;i++)
dt2[i]=0;
for(int i=1;i<=rand()%15+5;i++)
dt[rand()%20+1]=17;
dt[1]=1;
y=2,x=1;
dt[15]=k;
b=2,a=15;
dt[a+1]=0,dt[a-1]=0;
dt[a+2]=0,dt[a-2]=0;
}
int main()
{
hf(5);
system("mode con cols=350 lines=350");
std::ios::sync_with_stdio(0);
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
srand(unsigned(time(NULL)));
meng();
qp();
MessageBox(NULL,"qe光弹,j攻击,adw移动,s查看状态\n目标:打败决斗机器\n光弹的火焰可能会伤害自己!","孟银行小游戏消息",MB_OKCANCEL);
cout<<"_______________________"<<endl;
cout<<"| 第一关 Boss技能 封闭|"<<endl;
cout<<"______________________"<<endl;
Sleep(1000);
qp();
for(;;)
{
if(kbhit())
{
xs=getch();
if(xs=='a')
{
if(y==2&&x!=1&&dt[x-1]==0)
{
dt[x]=0;
x--;
dt[x]=18;
}
if(y==1)
{
dt2[x]=0;
x--;
dt2[x]=18;
}
}
if(xs=='d')
{
if(y==2&&x!=20&&dt[x+1]==0)
{
dt[x]=0;
x++;
dt[x]=18;
}
if(y==1)
{
dt2[x]=0;
x++;
dt2[x]=18;
}
}
if(xs=='w')
{
if(y!=1)
{
y=1;
hehe=4;
dt[x]=0;
dt2[x]=4;
}
}
if(xs=='s')
zt();
if(xs=='j')
{
if(y==2)
{
if(rand()%3+1==1) {
dt[x]=3,gj=2;
if(abs(x-a)==1) dl=dl-2;
}
else {
dt[x]=2,gj=2;
if(abs(x-a)==1) dl--;
}
}
else{
if(abs(x-a)==1) dl--;
}
}
if(xs=='q')
dt[x-1]=10;
if(xs=='e')
dt[x+1]=9;
}
else
{
if(y==2)
{
if(rand()%4+1)
dt[x]=1;
}
if(y==1)
{
if(rand()%4+1)
dt2[x]=1;
}
}
if(hehe!=-1) hehe--;
if(hehe<0&&dt[x]==0&&y==1){
dt2[x]=0;
dt[x]=1;
y=2;
}
for(int i=21;i>=0;i--)
{
gotoxy(0,0);
pt(dt2[i],i);
}
cout<<endl;
for(int i=21;i>=0;i--)
{
gotoxy(0,4);
pt(dt[i],i);
}
if(gj!=-1)
{
gj--;
}
if(gj<0&&(dt[x]==3||dt[x]==2))
{
dt[x]=1;
}
if((dt[x+1]>=11&&dt[x+1]<=16)||(dt[x-1]>=11&&dt[x-1]<=16)) sl--;
if((dt[a+1]>=11&&dt[a+1]<=16)||(dt[a-1]>=11&&dt[a-1]<=16)) dl--;
for(int i=1;i<=20;i++)
{
if(dt[i]==9&&dt[i+1]==0)
{ dt[i]=0,dt[i+1]=9;break;
}
else if(dt[i]==9) dt[i]=16;
if(dt[i]==10&&dt[i-1]==0)
dt[i]=0,dt[--i]=10;
else if(dt[i]==10) dt[i]=16;
if(dt[i]>11&&dt[i]<=16) dt[i]--;
if(dt[i]==11) dt[i]=0;
}
if(sl<=0) {
system("cls");
out("you are die!!!!");
Sleep(1000);
return 0;
}
if(dl<=0)
{
system("cls");
out("you are win!!!!");
Sleep(1000);
break;
}
if(dl==10)
{
dt[a+1]=17;
dt[a-1]=17;
bool f=false;
MessageBox(NULL,"决斗机器将自己封闭起来了!\n勇士啊,冲上去打败它吧!","孟银行小游戏消息",MB_OKCANCEL);
dl--;
}
if(dl==1)
dt[a]=16;
if(rand()%10+1==3&&(dt[a-1]==0||dt[a+1]==0))
dt[a-1]=10,dt[a+1]=9;
Sleep(30);
}
hf(19);
system("cls");
cout<<"获得技能①——————压制:在敌人旁边时,敌人无法发射子弹"<<endl;
cout<<"_______________________"<<endl;
cout<<"| 第二关 boss技能:恢复|"<<endl;
cout<<"__________________________"<<endl;
cout<<"摧毁Boss头顶核心即可阻止恢复!!!";
Sleep(1000);
qp();
dt2[a]=20;
for(;;)
{
if(kbhit())
{
xs=getch();
if(xs=='a')
{
if(y==2&&x!=1&&dt[x-1]==0)
{
dt[x]=0;
x--;
dt[x]=18;
}
if(y==1)
{
dt2[x]=0;
x--;
dt2[x]=18;
}
}
if(xs=='d')
{
if(y==2&&x!=20&&dt[x+1]==0)
{
dt[x]=0;
x++;
dt[x]=18;
}
if(y==1)
{
dt2[x]=0;
x++;
dt2[x]=18;
}
}
if(xs=='w')
{
if(y!=1)
{
y=1;
hehe=4;
dt[x]=0;
dt2[x]=4;
}
}
if(xs=='s')
zt();
if(xs=='j')
{
if(y==2)
{
if(rand()%3+1==1) {
dt[x]=3,gj=2;
if(abs(x-a)==1) dl=dl-2;
}
else {
dt[x]=2,gj=2;
if(abs(x-a)==1) dl--;
}
}
else{
if(abs(x-a)==1) dl--;
}
}
if(xs=='q')
dt[x-1]=10;
if(xs=='e')
dt[x+1]=9;
}
else
{
if(y==2)
{
if(rand()%4+1)
dt[x]=1;
}
if(y==1)
{
if(rand()%4+1)
dt2[x]=1;
}
}
if(hehe!=-1) hehe--;
if(hehe<0&&dt[x]==0&&y==1){
dt2[x]=0;
dt[x]=1;
y=2;
}
for(int i=21;i>=0;i--)
{
gotoxy(0,0);
pt(dt2[i],i);
}
cout<<endl;
for(int i=21;i>=0;i--)
{
gotoxy(0,4);
pt(dt[i],i);
}
if(gj!=-1)
{
gj--;
}
if(gj<0&&(dt[x]==3||dt[x]==2))
{
dt[x]=1;
}
if((dt[x+1]>=11&&dt[x+1]<=16)||(dt[x-1]>=11&&dt[x-1]<=16)) sl--;
if((dt[a+1]>=11&&dt[a+1]<=16)||(dt[a-1]>=11&&dt[a-1]<=16)) dl--;
for(int i=1;i<=20;i++)
{
if(dt[i]==9&&dt[i+1]==0)
{ dt[i]=0,dt[i+1]=9;break;
}
else if(dt[i]==9) dt[i]=16;
if(dt[i]==10&&dt[i-1]==0)
dt[i]=0,dt[--i]=10;
else if(dt[i]==10) dt[i]=16;
if(dt[i]>11&&dt[i]<=16) dt[i]--;
if(dt[i]==11) dt[i]=0;
}
if(sl<=0) {
system("cls");
out("you are die!!!!");
Sleep(1000);
return 0;
}
if(dl<=0)
{
system("cls");
out("you are win!!!!");
Sleep(1000);
break;
}
if(rand()%100+1==3&&dt2[a]==20)
{
MessageBox(NULL,"Boss启用技能!恢复","孟银行小游戏消息",MB_OKCANCEL);
dl=dl+20;
}
if(dl==1)
dt[a]=16;
if(rand()%10+1==3&&(dt[a-1]==0&&dt[a+1]==0))
dt[a-1]=10,dt[a+1]=9;
Sleep(30);
}
hf(21);
system("cls");
cout<<"获得Boss技能②——————恢复"<<endl;
cout<<"________________________________________________________________"<<endl;
cout<<"| 第三关 boss技能:冲刺:当你在Boss附近时,Boss会冲过来,造成伤害|"<<endl;
cout<<"________________________________________________________________"<<endl;
Sleep(1000);
qp();
dt2[a]=20;
for(;;)
{
if(rand()%50+1==2) sl=sl+10;
if(kbhit())
{
xs=getch();
if(xs=='a')
{
if(y==2&&x!=1&&dt[x-1]==0)
{
dt[x]=0;
x--;
dt[x]=18;
}
if(y==1)
{
dt2[x]=0;
x--;
dt2[x]=18;
}
}
if(xs=='d')
{
if(y==2&&x!=20&&dt[x+1]==0)
{
dt[x]=0;
x++;
dt[x]=18;
}
if(y==1)
{
dt2[x]=0;
x++;
dt2[x]=18;
}
}
if(xs=='w')
{
if(y!=1)
{
y=1;
hehe=4;
dt[x]=0;
dt2[x]=4;
}
}
if(xs=='s')
zt();
if(xs=='j')
{
if(y==2)
{
if(rand()%3+1==1) {
dt[x]=3,gj=2;
if(abs(x-a)==1) dl=dl-2;
}
else {
dt[x]=2,gj=2;
if(abs(x-a)==1) dl--;
}
}
else{
if(abs(x-a)==1) dl--;
}
}
if(xs=='q')
dt[x-1]=10;
if(xs=='e')
dt[x+1]=9;
}
else
{
if(y==2)
{
if(rand()%4+1)
dt[x]=1;
}
if(y==1)
{
if(rand()%4+1)
dt2[x]=1;
}
}
if(hehe!=-1) hehe--;
if(hehe<0&&dt[x]==0&&y==1){
dt2[x]=0;
dt[x]=1;
y=2;
}
for(int i=21;i>=0;i--)
{
gotoxy(0,0);
pt(dt2[i],i);
}
cout<<endl;
for(int i=21;i>=0;i--)
{
gotoxy(0,4);
pt(dt[i],i);
}
if(gj!=-1)
{
gj--;
}
if(gj<0&&(dt[x]==3||dt[x]==2))
{
dt[x]=1;
}
if((dt[x+1]>=11&&dt[x+1]<=16)||(dt[x-1]>=11&&dt[x-1]<=16)) sl--;
if((dt[a+1]>=11&&dt[a+1]<=16)||(dt[a-1]>=11&&dt[a-1]<=16)) dl--;
for(int i=1;i<=20;i++)
{
if(dt[i]==9&&dt[i+1]==0)
{ dt[i]=0,dt[i+1]=9;break;
}
else if(dt[i]==9) dt[i]=16;
if(dt[i]==10&&dt[i-1]==0)
dt[i]=0,dt[--i]=10;
else if(dt[i]==10) dt[i]=16;
if(dt[i]>11&&dt[i]<=16) dt[i]--;
if(dt[i]==11) dt[i]=0;
}
if(sl<=0) {
system("cls");
out("you are die!!!!");
Sleep(1000);
return 0;
}
if(dl<=0)
{
system("cls");
out("you are win!!!!");
Sleep(1000);
break;
}
if(x-a<=rand()%13+1&&x-a>=1&&rand()%15+1==3)
{
dt[a+2]=16;
dt[a]=0;
a++;
dt[a]=21;
}
if(a-x<=rand()%13+1&&a-x>=1&&rand()%15+1==3)
{
dt[a-2]=16;
dt[a]=0;
a--;
dt[a]=21;
}
dt[a]=21;
if(abs(x-a)<=1&&rand()%4+1) sl=sl-1;
if(rand()%100+1==2) dl=dl+2;
if(dl==1)
dt[a]=16;
if(rand()%10+1==3&&(dt[a-1]==0&&dt[a+1]==0))
dt[a-1]=10,dt[a+1]=9;
Sleep(30);
}
hf(22);
system("cls");
cout<<"获得技能③——————攻击加倍"<<endl;
cout<<"__________________________________________________________________________________________"<<endl;
cout<<"| 第四关 boss技能:火灵:会在你周围随机生成火快,破坏核心即可阻止,如在Boss旁会受到火焰伤害|"<<endl;
cout<<"__________________________________________________________________________________________"<<endl;
Sleep(1000);
qp();
dt2[a]=20;
for(;;)
{
if(rand()%50+1==2) sl=sl+15;
if(kbhit())
{
xs=getch();
if(xs=='a')
{
if(y==2&&x!=1&&dt[x-1]==0)
{
dt[x]=0;
x--;
dt[x]=18;
}
if(y==1)
{
dt2[x]=0;
x--;
dt2[x]=18;
}
}
if(xs=='d')
{
if(y==2&&x!=20&&dt[x+1]==0)
{
dt[x]=0;
x++;
dt[x]=18;
}
if(y==1)
{
dt2[x]=0;
x++;
dt2[x]=18;
}
}
if(xs=='w')
{
if(y!=1)
{
y=1;
hehe=4;
dt[x]=0;
dt2[x]=4;
}
}
if(xs=='s')
zt();
if(xs=='j')
{
if(y==2)
{
if(rand()%3+1==1) {
dt[x]=3,gj=2;
if(abs(x-a)==1) dl=dl-2;
}
else {
dt[x]=2,gj=2;
if(abs(x-a)==1) dl=dl-2;
}
}
else{
if(abs(x-a)==1) dl=dl-2;
}
}
if(xs=='q')
dt[x-1]=10;
if(xs=='e')
dt[x+1]=9;
}
else
{
if(y==2)
{
if(rand()%4+1)
dt[x]=1;
}
if(y==1)
{
if(rand()%4+1)
dt2[x]=1;
}
}
if(hehe!=-1) hehe--;
if(hehe<0&&dt[x]==0&&y==1){
dt2[x]=0;
dt[x]=1;
y=2;
}
for(int i=21;i>=0;i--)
{
gotoxy(0,0);
pt(dt2[i],i);
}
cout<<endl;
for(int i=21;i>=0;i--)
{
gotoxy(0,4);
pt(dt[i],i);
}
if(gj!=-1)
{
gj--;
}
if(gj<0&&(dt[x]==3||dt[x]==2))
{
dt[x]=1;
}
if((dt[x+1]>=11&&dt[x+1]<=16)||(dt[x-1]>=11&&dt[x-1]<=16)) sl--;
if((dt[a+1]>=11&&dt[a+1]<=16)||(dt[a-1]>=11&&dt[a-1]<=16)) dl--;
for(int i=1;i<=20;i++)
{
if(dt[i]==9&&dt[i+1]==0)
{ dt[i]=0,dt[i+1]=9;break;
}
else if(dt[i]==9) dt[i]=16;
if(dt[i]==10&&dt[i-1]==0)
dt[i]=0,dt[--i]=10;
else if(dt[i]==10) dt[i]=16;
if(dt[i]>11&&dt[i]<=16) dt[i]--;
if(dt[i]==11) dt[i]=0;
}
if(sl<=0) {
system("cls");
out("you are die!!!!");
Sleep(1000);
return 0;
}
if(dl<=0)
{
system("cls");
out("you are win!!!!");
Sleep(1000);
break;
}
dt[a]=22;
if(rand()%15+1==3&&dt2[a]==20)
{
dt[x-rand()%3+1]=16;
dt[x+rand()%3+1]=16;
}
if(abs(x-a)<=1&&rand()%4+1) sl=sl-1;
if(rand()%100+1==2) dl=dl+2;
if(dl==1)
dt[a]=16;
if(rand()%10+1==3&&(dt[a-1]==0&&dt[a+1]==0))
dt[a-1]=10,dt[a+1]=9;
Sleep(30);
}
hf(23);
system("cls");
cout<<"获得技能③——————随机火块"<<endl;
cout<<"_____________________________________________________________________________"<<endl;
cout<<"| 第五关 boss技能:水灵:无视火焰伤害,在Boss边会受到水伤害|"<<endl;
cout<<"_______________________________________________________________________________"<<endl;
Sleep(1000);
qp();
dt2[a]=20;
for(;;)
{
if(rand()%20+1==2) sl=sl+15;
if(kbhit())
{
xs=getch();
if(xs=='a')
{
if(y==2&&x!=1&&dt[x-1]==0)
{
dt[x]=0;
x--;
dt[x]=18;
}
if(y==1)
{
dt2[x]=0;
x--;
dt2[x]=18;
}
}
if(xs=='d')
{
if(y==2&&x!=20&&dt[x+1]==0)
{
dt[x]=0;
x++;
dt[x]=18;
}
if(y==1)
{
dt2[x]=0;
x++;
dt2[x]=18;
}
}
if(xs=='w')
{
if(y!=1)
{
y=1;
hehe=4;
dt[x]=0;
dt2[x]=4;
}
}
if(xs=='s')
zt();
if(xs=='j')
{
if(y==2)
{
if(rand()%3+1==1) {
dt[x]=3,gj=2;
if(abs(x-a)==1) dl=dl-2;
}
else {
dt[x]=2,gj=2;
if(abs(x-a)==1) dl=dl-2;
}
}
else{
if(abs(x-a)==1) dl=dl-2;
}
}
if(xs=='q')
dt[x-1]=10;
if(xs=='e')
dt[x+1]=9;
}
else
{
if(y==2)
{
if(rand()%4+1)
dt[x]=1;
}
if(y==1)
{
if(rand()%4+1)
dt2[x]=1;
}
}
if(hehe!=-1) hehe--;
if(hehe<0&&dt[x]==0&&y==1){
dt2[x]=0;
dt[x]=1;
y=2;
}
for(int i=21;i>=0;i--)
{
gotoxy(0,0);
pt(dt2[i],i);
}
cout<<endl;
for(int i=21;i>=0;i--)
{
gotoxy(0,4);
pt(dt[i],i);
}
if(gj!=-1)
{
gj--;
}
if(gj<0&&(dt[x]==3||dt[x]==2))
{
dt[x]=1;
}
if((dt[x+1]>=11&&dt[x+1]<=16)||(dt[x-1]>=11&&dt[x-1]<=16)) sl--;
if((dt[a+1]>=11&&dt[a+1]<=16)||(dt[a-1]>=11&&dt[a-1]<=16)&&dt[a]!=20) dl--;
for(int i=1;i<=20;i++)
{
if(dt[i]==9&&dt[i+1]==0)
{ dt[i]=0,dt[i+1]=9;break;
}
else if(dt[i]==9) dt[i]=16;
if(dt[i]==10&&dt[i-1]==0)
dt[i]=0,dt[--i]=10;
else if(dt[i]==10) dt[i]=16;
if(dt[i]>11&&dt[i]<=16) dt[i]--;
if(dt[i]==11) dt[i]=0;
}
if(sl<=0) {
system("cls");
out("you are die!!!!");
Sleep(1000);
return 0;
}
if(dl<=0)
{
system("cls");
out("you are win!!!!");
Sleep(1000);
break;
}
dt[a]=23;
if(abs(x-a)<=1&&rand()%4+1) sl=sl-5;
if(rand()%100+1==2) dl=dl+2;
if(dl==1)
dt[a]=16;
if(rand()%10+1==3&&(dt[a-1]==0&&dt[a+1]==0))
dt[a-1]=10,dt[a+1]=9;
Sleep(30);
if(rand()%13+1==3) dt[a-rand()%3+1]=16,dt[a+rand()%3+1]=16;
}
Bl();
Sleep(1000);
system("color 0F");
out("一声巨响!");
out("几道光闪过,在你的面前,出现了一个巨大无比,闪着恐怖光芒的怪物!!!");
out("你握紧了武器,决战的时刻到了");
Sleep(1000);
hf(24);
system("cls");
cout<<"获得技能④——————水灵:有几率减少火焰伤害"<<endl;
cout<<"__________________"<<endl;
cout<<"| 最终关 融合Boss|"<<endl;
cout<<"_________________"<<endl;
cout<<"摧毁Boss头顶核心即可阻止恢复!!!";
Sleep(1000);
qp();
dt2[a]=20;
for(;;)
{
if(rand()%50+1==2) sl=sl+20;
if(kbhit())
{
xs=getch();
if(xs=='a')
{
if(y==2&&x!=1&&dt[x-1]==0)
{
dt[x]=0;
x--;
dt[x]=18;
}
if(y==1)
{
dt2[x]=0;
x--;
dt2[x]=18;
}
}
if(xs=='d')
{
if(y==2&&x!=20&&dt[x+1]==0)
{
dt[x]=0;
x++;
dt[x]=18;
}
if(y==1)
{
dt2[x]=0;
x++;
dt2[x]=18;
}
}
if(xs=='w')
{
if(y!=1)
{
y=1;
hehe=4;
dt[x]=0;
dt2[x]=4;
}
}
if(xs=='s')
zt();
if(xs=='j')
{
if(y==2)
{
if(rand()%3+1==1) {
dt[x]=3,gj=2;
if(abs(x-a)==1) dl=dl-2;
}
else {
dt[x]=2,gj=2;
if(abs(x-a)==1) dl=dl-2;
}
}
else{
if(abs(x-a)==1) dl=dl-2;
}
}
if(xs=='q')
dt[x-1]=10;
if(xs=='e')
dt[x+1]=9;
}
else
{
if(y==2)
{
if(rand()%4+1)
dt[x]=1;
}
if(y==1)
{
if(rand()%4+1)
dt2[x]=1;
}
}
if(hehe!=-1) hehe--;
if(hehe<0&&dt[x]==0&&y==1){
dt2[x]=0;
dt[x]=1;
y=2;
}
for(int i=21;i>=0;i--)
{
gotoxy(0,0);
pt(dt2[i],i);
}
cout<<endl;
for(int i=21;i>=0;i--)
{
gotoxy(0,4);
pt(dt[i],i);
}
if(gj!=-1)
{
gj--;
}
if(gj<0&&(dt[x]==3||dt[x]==2))
{
dt[x]=1;
}
if(((dt[x+1]>=11&&dt[x+1]<=16)||(dt[x-1]>=11&&dt[x-1]<=16))&&rand()%2+1==2) sl--;
if((dt[a+1]>=11&&dt[a+1]<=16)||(dt[a-1]>=11&&dt[a-1]<=16)&&dt[a]!=20) dl--;
for(int i=1;i<=20;i++)
{
if(dt[i]==9&&dt[i+1]==0)
{ dt[i]=0,dt[i+1]=9;break;
}
else if(dt[i]==9) dt[i]=16;
if(dt[i]==10&&dt[i-1]==0)
dt[i]=0,dt[--i]=10;
else if(dt[i]==10) dt[i]=16;
if(dt[i]>11&&dt[i]<=16) dt[i]--;
if(dt[i]==11) dt[i]=0;
}
if(sl<=0) {
system("cls");
out("you are die!!!!");
Sleep(1000);
return 0;
}
if(dl<=0)
{
system("cls");
out("you are win!!!!");
Sleep(1000);
break;
}
dt[a]=24;
if(abs(x-a)<=1&&rand()%4+1) sl=sl-5;
if(rand()%100+1==2) dl=dl+2;
if(dl==1)
dt[a]=16;
if(rand()%10+1==3&&(dt[a-1]==0&&dt[a+1]==0))
dt[a-1]=10,dt[a+1]=9;
Sleep(30);
if(rand()%13+1==3) dt[a-rand()%3+1]=16,dt[a+rand()%3+1]=16;
if(rand()%15+1==3&&dt2[a]==20)
{
dt[x-rand()%3+1]=16;
dt[x+rand()%3+1]=16;
}
if(x-a<=rand()%13+1&&x-a>=1&&rand()%15+1==3)
{
dt[a+2]=16;
dt[a]=0;
a++;
dt[a]=24;
}
if(a-x<=rand()%13+1&&a-x>=1&&rand()%15+1==3)
{
dt[a-2]=16;
dt[a]=0;
a--;
dt[a]=24;
}
if(rand()%100+1==3&&dt2[a]==20)
{
MessageBox(NULL,"Boss启用技能!恢复","孟银行小游戏消息",MB_OKCANCEL);
dl=dl+20;
}
if(rand()%100+1==3) dl=dl+6;
}
system("cls");
out("最后的怪兽倒在了山下");
out("你最后望了花果山一眼,红日初升,如一只血红的眼睛");
out("望着雾蒙蒙的山头,你不禁一振颤抖");
out("“这座山很怪………………”");
Sleep(!000);
Bl();
}
通关(不算调试)祭
为啥这么难!!而且代码也不好改
..............
为肾么这么难??!
( ̄▽ ̄)”
(编者邪恶的笑容)
可以改代码啊!
呵呵呵我*
我TM自己的GAME打了10几把都没过
^_^
●█▀█▄○| ̄|_orz
呵呵
(也就)
能不能修改一下
这样看着很累(
我也很想啊
这玩意跟洛谷不一样啊
建议