目录
一、变色小跳龙
二、超级按钮
三、超级迷宫
四 、城市守卫战
五、 愤怒的小胎
既然是胎神游戏集,那当然要先感谢我们的胎神大大了
胎神洛谷名:TSzza
好了,言归正传,知道你们不喜欢啰嗦,直接上代码
#include
#include
#include
#include
#include
using namespace std;
void SetPos(int x,int y)
{
COORD pos;pos.X=y*2,pos.Y=x;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
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_RED|FOREGROUND_BLUE);
if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
}
int Se,Tx,X=7,K,T,SS,xt,H=3,Wu,Mk;
int m[10001];
void Sheng()
{
int R=rand()%10,RR=rand()%100;
if(R==0) SS=rand()%3-1;K++;
if(RR==0)
{
int rr=rand()%4+2;
for(int i=1;i<=rr;i++) m[K+i+20]=2;
}
else if(m[K+20]==0) m[K+20]=SS;
}
void Map(int a)
{
Color(0);
if(a==1)
{
for(int i=0;i<=7;i++) SetPos(i,1),cout<<' ';
SetPos(X,1);Color(Se+1);if(Wu!=0&&T%3==0) Color(4);
if(X==7&&m[K+1]==2&&Wu<=0) SetPos(8,1);cout<<"●";
}
if(a==2)
{
SetPos(8,0);
for(int i=K;i<=K+20;i++) {if(m[i]!=2) Color(m[i]+1),cout<<"■";else cout<<" ";if(T==1) Sleep(30);}
}
if(a==3)
{
Color(3);if(Wu!=0&&T%3==0) Color(4);
SetPos(3,15);for(int i=0;i=Mk) Mk=T/5;SetPos(2,17),cout<0) {Wu--;if(m[K+1]==0||m[K+1]==1) Se=m[K+1];}
if(K==90||K==480||K==970||K==1460||K==2100) SetPos(5,10),Color(3),cout<<"Warning!! LEVEL UP!";
if(K==110||K==520||K==1030||K==1540||K==2250) SetPos(5,10),cout<<" ";
if(kbhit())
{
char g=_getch();
if(g==72&&xt<2) {if(X==7) X--;Tx=4,xt++;}
if(g==80&&Wu<=0) Se=(Se+1)%2,Map(2);
}
if(T%4==0) {if(Tx>0) {Tx--;if(X>=2) X--;}else if(X<7) X++;Map(1);}
if(K<=100&&T%7==0) Sheng(),Map(2);
if(K<500&&K>=100&&T%5==0) Sheng(),Map(2);
if(K<1000&&K>=500&&T%4==0) Sheng(),Map(2);
if(K<1500&&K>=1000&&T%3==0) Sheng(),Map(2);
if(K<2200&&K>=1500&&T%2==0) Sheng(),Map(2);
if(K>=2200) Sheng(),Map(2);
Map(3);Sleep(10);
}system("color 4F");
if(H>0) {H--,Sleep(10),Se=(Se+1)%2,system("color 0F");goto KK;}
SetPos(5,10),Sleep(1000),Color(0),system("pause");SetPos(5,10),cout<<" ";
system("color 0F"); goto Re;
return 0;
}
#include
#include
#include
using namespace std;
int mouse,S,An,k,t,Rr,T;
POINT Windowpos()
{
POINT pt;
GetCursorPos(&pt);
HWND h=GetForegroundWindow();
ScreenToClient(h,&pt);
pt.x/=8;pt.y/=16;
return pt;
}
void SlowDisplay(int x,char *p)
{
while(1)
{
if(*p!=0) printf("%c",*p++);
else break;Sleep(x);
}
}
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);
if(a==2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
if(a==3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
if(a==4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);
}
void Luan()
{
if(Rr==0) printf("┃过天按钮┃");
if(Rr==1) printf("┃过关按扭┃");
if(Rr==2) printf("┃过关按纽┃");
if(Rr==3) printf("┃过关按忸┃");
if(Rr==4) printf("┃过关桉钮┃");
if(Rr==5) printf("┃过关侒钮┃");
if(Rr==6) printf("┃过关按杻┃");
if(Rr==7) printf("┃过关按炄┃");
if(Rr==8) printf("┃过关铵钮┃");
if(Rr==9) printf("┃过关胺钮┃");
}
void Die()
{
system("color 4F");
Sleep(2000);system("color 0F");
system("cls"); Color(0);
SlowDisplay(50,"\nWarning!\nSYSTEM ERROR!!\nThe system is about to collapse!!!");
Sleep(1000);system("shutdown /s");
}
void SetPos(int x,int y)
{
COORD pos; pos.X=y,pos.Y=x;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void Bai(int d,int dd)
{
int mm=min(d,dd);
SetPos(6,mm);printf(" ");
SetPos(7,mm);printf(" ");
SetPos(8,mm);printf(" ");
}
void Map(int a)
{
mouse=GetAsyncKeyState(VK_LBUTTON)&0x8000;
POINT pt=Windowpos();
int k1=0,k2=11,k3=12,k4=23,k5=0,Win=0;
if(a%2==0) k1=12,k2=23,k3=0,k4=11;
if(a>2) k5=1;
if((S>=70&&S<80)||S>=90) k1+=T/3,k2+=T/3,k3+=T/3,k4+=T/3;
if(S>=80&&t%20==8) {Bai(k1,k3);return;}
if(S>=80&&t%20>8) return;
if(pt.x>=k1&&pt.x<=k2&&pt.y>=6&&pt.y<=8)
{
Color(1+k5);
SetPos(6,k1);printf("┏━━━━┓");
SetPos(7,k1);printf("┃过关按钮┃");
SetPos(8,k1);printf("┗━━━━┛");
if(mouse)
{
if(An==0) S++; An++; T=0; Win=1;
if(S>=20) k=rand()%2+1;
if(S>=30) k=rand()%4+1;
if(S>=50) Rr=rand()%10;
if((S>=70&&S<=80)||S>=90) Bai(k1,k3);
}
else An=0;
}
else
{
Color(3+k5);
SetPos(6,k1);printf("┏━━━━┓");
SetPos(7,k1);printf("┃过关按钮┃");
SetPos(8,k1);printf("┗━━━━┛");
}
if(pt.x>=k3&&pt.x<=k4&&pt.y>=6&&pt.y<=8&&Win==0)
{
Color(2-k5);
if(S>=40&&T>=10) mouse=1;
SetPos(6,k3);printf("┏━━━━┓");
SetPos(7,k3);if(S<50) printf("┃关机按钮┃");else Luan();
SetPos(8,k3);printf("┗━━━━┛");
if(mouse) {if(An==0) Die();An=0;}
}
else if(Win==0)
{
Color(4-k5);
SetPos(6,k3);printf("┏━━━━┓");
SetPos(7,k3);if(S<50) printf("┃关机按钮┃");else Luan();
SetPos(8,k3);printf("┗━━━━┛");
}
}
int main()
{
srand(unsigned(time(NULL)));
ios::sync_with_stdio(false);
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
Color(0);k=1;
SlowDisplay(200,"欢迎来到超级按钮!你的目标是按下按钮100次!\n\n");
SetPos(2,0),printf("已开启普通模式。");
while(S<100)
{
t++;T++;Color(0);
SetPos(4,0);Color(0);printf("还需按%d次。\n\n",100-S);
if(S==20&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启按钮混乱模式。");
if(S==30&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启按钮混乱2.0模式。");
if(S==40&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启接触引爆模式。");
if(S==50&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启按钮混乱3.0模式。");
if(S==60&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启定时引爆模式。");
if(S==70&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启移动按钮模式。");
if(S==80&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启隐形按钮模式。");
if(S==90&&T==1) SetPos(2,0),printf(" "),SetPos(2,0),printf("已开启隐形移动按钮模式。");
if(S>=60)SetPos(2,20),printf("%d ",100-T);
if(S>=60&&T>=100) {Die();break;}
POINT pt; GetCursorPos(&pt);
int k1=0,k2=11,k3=12,k4=23;
if(k==2) k1=12,k2=23,k3=0,k4=11;
Sleep(50); Map(k);
}
if(S>=100)
{
system("cls");Color(0);
SlowDisplay(200,"\n让你通关吧!");
}
}
#include
#include
#include
using namespace std;
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==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
if(a==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|BACKGROUND_RED);
}
void Setpos(int x,int y){COORD pos;pos.X=y*2,pos.Y=x;SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);}
int R[5];
void SlowDisplay(int x,char *p){while(1){if(*p!=0) printf("%c",*p++);else break;Sleep(x);}}
struct xg{int xgx,xgy;bool fx,sw=0; }xg[21];
int ys=0,hd=0,sj=0,sl=0,mg=0,hp=0,hss=0,hsx=0,jt=0,s=0;
char ch[35][35];
char ch1[35][35]={"", " ##### ##### ########"," ## ### ### "," #### # ## #### #### "," ### ## # ####! ## "," ###& ### +## ###### ####"," #################! ##"," # *# ! ######### ###-##"," # ### ##### # "," # ###*# ############### ### "," # ##### ####"," # # # ##-############## "," ###### #####! "," #+ # ###### ############ ", " ########### ### ### ### ## "," # ! ! #"," ############################"," # ! # ! # #"," # ! # ! #### "," ########################### "," ) ",};
char ch2[35][35]={""," ##############################"," #* #"," ##########################-#"," # # #"," # # ####################-# #"," # # # ! +# # #"," # # # ################ # # #"," # # # # # # # #"," # # # # ############ # # # #"," # # # # #)- ! # # # & #"," # # # # ### ! # # # # #", " # # # ################ # # #"," # # # ! # #"," # # ###################### #"," # # ! *# #"," # ########### ############ #"," # ! # # ! #"," # ############# ########### #"," # ! #"," ##############################", };
char ch3[31][33]={""," ##############################"," #. + .#"," # ! #"," # + ! #"," # #"," # ! + #"," # ! + ! #"," # + #"," # + ! #", " # + ! #"," # ! + #"," #+ _____ #"," # |_ _ _| + #"," # + |_|||_| #"," # + |MMMMM| !#"," # |WWWWW| #"," #! |_____| #"," # ! #"," #. + .#"," ##############################", };
char ch4[35][35]={""," ###*### ########"," ###! # ##### # *#"," ###+####### # # # # ######"," # !# # #-# # # # #"," ######### # # # # ## #"," ####### ##### # ## #"," ###### ! ! !# ## #"," # ################ ## #"," ### !! ## "," #### ###################### "," # ! !# "," #-#################### ## "," #-#ooooooooooo o # #*## "," o ooo o o o o ooo # #### "," o o o o oo o o # "," ooo o ooooooo oo ooo o #######"," ooo o o o oo o #"," ooo o o o*oooooooooooooooo-#"," ooooooo o oo o o o o #"," ) o o o o o #",};
char ch5[35][35]={""," oooo oooooooooooooooooooo"," ooo o oo+oo o o"," ooooooo*oooo ! o ! o o o"," o o o o o o o"," oooooooooo ooooooooooooooooo o"," o ! ! o"," oooooooo ooooooooooooooooooooo"," oooooooo ooooooooooooooooooooo", " o ! o"," o^^^^^^^^^^^^^^^^^^^^^^^^^^^^o"," o ! ! ! ! ! o"," o^^^^^^^^^^^^^^^^^^^^^^^^^^^^o"," o^*^! !^! !^! ^^! +^! !^! *^o"," o^^^^^^^^^^^^^^^^^^^^^^^^^^^^o"," o ! ! ! ! ! o"," #^^^^^^^^^^^^^^^^^^^^^^^^^^^^#"," # ! #"," ####oooooooooo--oooooooooooo##"," ########oooooo--ooooooo#######"," ###########ooo))oooo##########", };
char ch6[35][35]={""," oooooooooooooo .oooooooooooooo"," o+oooooooooooo oooooooooooo+o"," ooooooooooooo# #ooooooooooooo"," oooooooooooo#^^^^#oooooooooooo"," oooo*oooooo#^ ^#oooooo*oooo"," oooooooooo# ^ ^ #oooooooooo"," ooooooooo# ^ ^ #ooooooooo"," oooooooo#^^^^^^^^^^^^#oooooooo"," ooooooo#^ ^#--#^ ^#ooooooo"," . ^ ^-NO-^ ^ "," ^ ^-IP-^ ^ ."," ooooooo#^ ^#--#^ ^#ooooooo"," oooooooo#^^^^^^^^^^^^#oooooooo"," ooooooooo# ^ ^ #ooooooooo"," oooooooooo# ^ ^ #oooooooooo"," oooo*oooooo#^ ^#oooooo*oooo"," oooooooooooo#^^^^#oooooooooooo"," ooooooooooooo# #ooooooooooooo"," o+oooooooooooo oooooooooooo+o"," oooooooooooooo. oooooooooooooo",};
void map1(int x,int y,int k){
for(int i=1;i<=20;++i)
for(int j=1;j<=30;++j){
bool f=1;
for (int l=1;l<=k;++l)
if (xg[l].xgx==i&&xg[l].xgy==j&&xg[l].sw==0) {Setpos(i,j);Color(4),cout<<"▼";f=0;break;}
if (f==1)
{Setpos(i,j);
if (i==x&&j==y) Color(1),cout<<"●";
else if (ch[i][j]=='#'||ch[i][j]=='&') Color(7),cout<<"■";
else if (ch[i][j]==')') Color(5),cout<<"☆";
else if (ch[i][j]=='*') Color(5),cout<<"♂";
else if (ch[i][j]=='-') Color(3),cout<<"▋";
else if (ch[i][j]=='+') Color(2),cout<<"◆";
else if (ch[i][j]=='.') Color(1),cout<<"◆";
else if (ch[i][j]=='o') Color(8),cout<<"~ ";
else if (ch[i][j]=='_') Color(3),cout<<"▁";
else if (ch[i][j]=='^') Color(3),cout<<"▲";
else if (ch[i][j]=='|') Color(3),cout<<"|";
else if (ch[i][j]=='M') Color(3),cout<<'M'<<'M';
else if (ch[i][j]=='W') Color(3),cout<<'W'<<'W';
else if (ch[i][j]=='N') Color(2),cout<<"NO";
else if (ch[i][j]=='I') Color(2),cout<<"..";
else if (ch[i][j]=='O') Color(2),cout<<"I!";
else if (ch[i][j]=='P') Color(2),cout<<".P";
else Color(0),cout<<" ";
}
}
Setpos(21,3);Color(5),cout<<"["<=10))&&xg[i].xgy!=30) Setpos(xg[i].xgx,xg[i].xgy),cout<<" ",xg[i].xgy++,Setpos(xg[i].xgx,xg[i].xgy),Color(4),cout<<"▼";
else if (xg[i].fx==1&&(ch[xg[i].xgx][xg[i].xgy-1]==' '||(ch[xg[i].xgx][xg[i].xgy-1]=='^'&&T%20>=10))&&xg[i].xgy!=1) Setpos(xg[i].xgx,xg[i].xgy),cout<<" ",xg[i].xgy--,Setpos(xg[i].xgx,xg[i].xgy),Color(4),cout<<"▼";
else if (xg[i].fx==1) xg[i].fx=0;else xg[i].fx=1;}
for (int i=1;i<=k;i++){
if (xg[i].xgx==x&&xg[i].xgy==y&&xg[i].sw==0&&hd==0) {system("cls");cout<<"怪物啊!!!";Sleep(2000);system("cls");return 0;}
else if (xg[i].xgx==x&&xg[i].xgy==y&&hd>0&&xg[i].sw==0) {system("cls");cout<<"护盾保护了你!";Sleep(1000);system("cls");map1(x,y,k);hd--;xg[i].sw=1;}}
if (ch[x][y]==')') {system("cls");cout<<"You Win!";Sleep(2000);system("cls");win=1;}
if (ch[x][y]=='*') {system("cls");cout<<"你找到了钥匙!";ys++;Sleep(1000);system("cls");map1(x,y,k);ch[x][y]=' ';}
if (ch[x][y]=='.') {system("cls");cout<<"你破坏了水晶!";sj++;Sleep(1000);system("cls");map1(x,y,k);ch[x][y]=' ';}
if (ch[x][y]=='-'&&ys>0) {system("cls");cout<<"门开了!";ys--;Sleep(1000);system("cls");map1(x,y,k);ch[x][y]=' ';}else if (ch[x][y]=='-') {system("cls");cout<<"你没有钥匙!";--x;Sleep(3000);system("cls");map1(x,y,k);}
if (ch[x][y]=='+') {system("cls");cout<<"你找到了护盾!";hd++;Sleep(1000);system("cls");map1(x,y,k);ch[x][y]=' ';}
if (ch[x][y]=='o'&&hd==0) {system("cls");cout<<"烫死啦!!!";Sleep(2000);return 0;}
else if (hd>0&&ch[x][y]=='o') {system("cls");cout<<"护盾保护了你!";ch[x][y]=' ';hd--;Sleep(1000);system("cls");map1(x,y,k);}
if (ch[x][y]=='^'&&T%20<10&&hd==0) {system("cls");cout<<"被刺穿啦!!!";Sleep(2000);return 0;}
else if (hd>0&&ch[x][y]=='^'&&T%20<10) {system("cls");cout<<"护盾保护了你!";ch[x][y]=' ';hd--;Sleep(1000);system("cls");map1(x,y,k);}
if ((a==3||a==6)&&sj==4) {system("cls");cout<<"You Win!";Sleep(2000);system("cls");win=1;}
for (int i=1;i<=k;i++)
if (xg[i].xgx==x&&xg[i].xgy==y&&xg[i].sw==0&&hd==0) {system("cls");cout<<"怪物啊!!!";Sleep(1000);system("cls");return 0;}
else if (xg[i].xgx==x&&xg[i].xgy==y&&hd>0&&xg[i].sw==0) {system("cls");cout<<"护盾保护了你!";Sleep(1000);system("cls");map1(x,y,k);map1(x,y,k);hd--;xg[i].sw=1;}
if(win==1){if(a==1)sl=1;if(a==2)mg=1;if(a==3)hp=1;if(a==4)hss=1;if(a==5)hsx=1;return 0;}
Sleep(100);
}}
bool dd()
{
system("cls");cout<<"9%......";Sleep(200);system("cls");cout<<"26%......";Sleep(200);system("cls");cout<<"33%......";Sleep(200);system("cls");cout<<"47%......";Sleep(200);system("cls");cout<<"68%......";Sleep(200);system("cls");cout<<"82%......";Sleep(200);system("cls");cout<<"94%......";Sleep(200);system("cls");cout<<"100%......"<>a;
if (a==1&&dd()) {yx(1);}if (a==2&&sl==1&&dd()){yx(2);}if (a==3&&mg==1&&dd()) {yx(3);}if (a==4&&hp==1&&dd()) {yx(4);}if (a==5&&hss==1&&dd()){yx(5);}if (a==6&&hsx==1&&dd()){yx(6);}if (a==0) return;
}}
void gz() {
system("cls");
cout<<"由上下左右键控制"<>a;
if (a==1) ml();
else gz();
}
int main(){
CONSOLE_CURSOR_INFO cursor_info={1,0};SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);srand((unsigned)time(NULL));
cout<<"欢迎来到超级迷宫!"<>a;if (a==1){system("cls");ml();}else if (a==2){gz();}
return 0;
}
#include
#include
#include
#include
using namespace std;
int t,nl,dl,Money,Moo,Dao,Yi,Shan,Qing,Hu;
int Biao,Biaob,Bao=1,Baob,Baod=1,Baodb,Hub,Fengb,Sha,Jian,Shab,Jianb;
int X[10];
bool Daob,Yib,Shanb,Qingb,Hubb;
struct node {int Zhong,Xue,Bing,Hui,Du;} N[100001],D[100001];
void Yan(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);
}
void Bai() {SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);}
void Cout(int x,int a)
{
Yan(a);int k;
if(x==1) {if(a==0) cout<<"城墙";if(a==1) cout<<"加农炮";if(a==2) cout<<"重机枪";if(a==3) cout<<"迫击炮";if(a==4) cout<<"喷火器";if(a==5) cout<<"火箭炮";if(a>=6) cout<<"电磁炮";}
if(x==2)
{
if(a==1) cout<<"步兵",Money+=20,k=20;if(a==2) cout<<"骑兵",Money+=30,k=30;if(a==3) cout<<"炮兵",Money+=30,k=30;if(a==4) cout<<"药兵",Money+=30,k=30;if(a==6||a==7) cout<<"炮灰",Money+=10,k=10;if(a==5) cout<<"坦克",Money+=50,k=50;
if(a==8) Yan(3),cout<<"金刚机甲",Money+=100;if(a==9) Yan(1),cout<<"寒冰机甲",Money+=100;if(a==10) Yan(2),cout<<"木毒机甲",Money+=100;if(a==11) Yan(3),cout<<"飓风机甲",Money+=100;if(a==12) Yan(4),cout<<"烈焰机甲",Money+=100;if(a>=8) k=100;
}
Yan(4);Sleep(200),cout<<"......爆!!!";
if(x==2) Yan(5),cout<<"掉落"<=300) Money=300,Yan(3),cout<<"金币储量已达上限!"<0) zn=nl%5;if(dl-5>0) zd=dl%5;cout<<"┌";
for(int i=0;i<=40;i++) cout<<'-';cout<<"┐"<0;i--) if(i>=nl+1) cout<<" ";
for(int i=5;i>0;i--)
{
if(i>=nl+1) continue;
Yan(1);if(i<=0) break;
if(N[i].Bing>0) Yan(6);
if(N[i].Du>0) Yan(2);
if(N[i].Hui>0) Yan(3);
cout<dl) {cout<<" ";continue;}
if(Baodb!=0) Yan(2);
if(D[i].Zhong>=8) Yan(3);
cout<0;i--) if(i>=nl+1) cout<<" ";
for(int i=5;i>0;i--)
{
if(i>=nl+1) continue;
Yan(N[i].Zhong);if(N[i].Bing>0) Yan(6);
if(N[i].Zhong==0) cout<<" ▎";if(N[i].Zhong==1) cout<<" ●";if(N[i].Zhong==2) cout<<" ■";if(N[i].Zhong==3) cout<<" ▲";if(N[i].Zhong==4) cout<<" ▼";if(N[i].Zhong==5) cout<<" ★";if(N[i].Zhong>=6) cout<<" ◆";
Bai();
}
for(int i=1;i<=5;i++)
{
if(i>dl) {cout<<" ";continue;}
Yan(D[i].Zhong);if(D[i].Bing>0) Yan(4);
if(D[i].Zhong==1) cout<<" ○";if(D[i].Zhong==2) cout<<" □";if(D[i].Zhong==3) cout<<" △";if(D[i].Zhong==4) cout<<" ▽";if(D[i].Zhong==5) cout<<" ☆";if(D[i].Zhong>=6&&D[i].Zhong<=7) cout<<" ◇";if(D[i].Zhong==8) Yan(5),cout<<" 金";if(D[i].Zhong==9) Yan(1),cout<<" 冰";if(D[i].Zhong==10) Yan(2),cout<<" 毒";if(D[i].Zhong==11) Yan(3),cout<<" 风";if(D[i].Zhong==12) Yan(4),cout<<" 火";
Bai();
}
if(zn>0||zd>0)
{
cout<<" ┆"<0;i--) cout<<" ";
for(int i=5+zn;i>5;i--)
{
Yan(1);if(i<=0) break;
if(N[i].Bing>0) Yan(6);
if(N[i].Du>0) Yan(2);
if(N[i].Hui>0) Yan(3);
cout<dl) {cout<<" ";continue;}
if(Baodb!=0) Yan(2);
if(D[i].Zhong>=8) Yan(3);
cout<0;i--) {cout<<" ";continue;}
for(int i=5+zn;i>5;i--)
{
Yan(N[i].Zhong);if(N[i].Bing>0) Yan(6);
if(N[i].Zhong==0) cout<<" ▎";if(N[i].Zhong==1) cout<<" ●";if(N[i].Zhong==2) cout<<" ■";if(N[i].Zhong==3) cout<<" ▲";if(N[i].Zhong==4) cout<<" ▼";if(N[i].Zhong==5) cout<<" ★";if(N[i].Zhong>=6) cout<<" ◆";
Bai();
}
for(int i=6;i<=10;i++)
{
if(i>dl) {cout<<" ";continue;}
Yan(D[i].Zhong);if(D[i].Bing>0) Yan(4);
if(D[i].Zhong==1) cout<<" ○";if(D[i].Zhong==2) cout<<" □";if(D[i].Zhong==3) cout<<" △";if(D[i].Zhong==4) cout<<" ▽";if(D[i].Zhong==5) cout<<" ☆";if(D[i].Zhong>=6&&D[i].Zhong<=7) cout<<" ◇";if(D[i].Zhong==8) Yan(5),cout<<" 金";if(D[i].Zhong==9) Yan(1),cout<<" 冰";if(D[i].Zhong==10) Yan(2),cout<<" 毒";if(D[i].Zhong==11) Yan(3),cout<<" 风";if(D[i].Zhong==12) Yan(4),cout<<" 火";
Bai();
}
}
cout<<" ┆"<=8) Moo=0;
Cout(2,D[m].Zhong);
for(int i=m;i=5))||(a==3&&(Money<150||X[3]>=5))||(a==4&&(Money<200||X[4]>=3))||(a==5&&(Money<250||X[0]>0))||(a==6&&(Money<270||X[6]+X[7]+X[8]>=2))||(a==7&&(Money<300||X[5]>=3)))
{Yan(3),cout<0;i--) swap(N[i],N[i-1]);N[1].Xue=500;}
if(a==6) N[nl].Xue=400,N[nl].Zhong=6,Money-=270;
if(a==7) N[nl].Xue=300,N[nl].Zhong=5,Money-=300;
Yan(5);cout<=300) Money=300,Yan(3),cout<<"金币储量已达上限!"<=8) D[dl].Xue=1000+bp*10,D[dl].Zhong=a;
}
void Yong(int a)
{
int b;
if(a==0) return;
if((a==1&&Dao==0)||(a==2&&Yi==0)||(a==3&&Shan==0)||(a==4&&Qing==0)||(a==5&&Hu==0)) {cout<<"无效输入。"<dl||b<=0) {cout<<"无效输入。"<nl||b<=0) {cout<<"无效输入。"<dl||b<=0) {cout<<"无效输入。"<=300) Money=300,Yan(3),cout<<"金币储量已达上限!"<=100)
{
memset(X,0,sizeof(X));
for(int i=1;i<=nl;i++) X[N[i].Zhong]++;
if(Money>=100) cout<<"你现在可以购买:1.加农炮 ";if(Money>=120&&X[2]<5) cout<<"2.重机枪 ";if(Money>=150&&X[3]<5) cout<<"3.迫击炮 ";if(Money>=200&&X[4]<3) cout<<"4.喷火器 ";
if(Money>=250&&X[0]==0) cout<<"5.城墙 ";if(Money>=270&&X[6]+X[7]+X[8]<2) cout<<"6.电磁炮 ";if(Money>=300&&X[5]<3) cout<<"7.火箭炮";
if(Money>=100)
{
cout<'7') {cout<<"无效输入。"<0||Yi>0||Shan>0||Qing>0||Hu>0)
{
War();
if(Dao>0||Yi>0||Shan>0||Qing>0||Hu>0) cout<<"你现在可以使用:"; if(Dao>0) cout<<"1.导弹("<0) cout<<"2.医疗包("<0) cout<<"3.闪光弹("<0) cout<<"4.狂暴血清("<0) cout<<"5.无敌护罩("<0||Yi>0||Shan>0||Qing>0||Hu>0)
{
cout<'9') {cout<<"无效输入。"<=2&&y<4) Yan(2),cout<<"呀!来了个骑兵!"<=4&&y<5) Yan(3),cout<<"呀!来了个炮兵!"<=5&&y<6) Yan(4),cout<<"呀!来了个药兵!"<=6&&y<7) Yan(6),cout<<"呀!来了个炮灰!"<=7&&y<10) Yan(5),cout<<"呀!来了个坦克!"<=10) cout<<"没有新敌人出现。"<0;i--) if(k[i]==1) Die(i);
}
void Jiu(int n)
{
Sleep(100);int R=15+rand()%11;
int y=rand()%n+1;
D[y].Xue+=R;
cout<=1&&x<3&&D[i].Bing==0)
{
Yan(4),cout<<"金刚机甲扫射!"<=3) {cout<<"金刚机甲蓄力。"<=3&&nl<4)||x==2) {cout<<"寒冰机甲蓄力。"<4)||(nl<4&&dl>=3)) {cout<<"木毒机甲蓄力。"<2&&x<=4) {Yan(4),cout<<"木毒机甲召唤!"<=3&&nl<4)||x==5) {cout<<"飓风机甲蓄力。"<=5) N[5].Xue-=R4,DieN(5);
if(nl>=4) N[4].Xue-=R3,DieN(4);
if(nl>=3) N[3].Xue-=R2,DieN(3);
if(nl>=2) N[2].Xue-=R1,DieN(2);
if(nl>=1) N[1].Xue-=R,DieN(1); return;
}
if(x==1&&D[i].Bing==0)
{
bool k[31];int R=25+rand()%11;
memset(k,0,sizeof(k));
Yan(4),cout<<"烈焰机甲的火焰聚成5个火球,向你飞来!";
if(Hub==0&&D[i].Bing==0)
{
cout<<"击中了第";
for(int i=0;i<5;i++)
{
int z=rand()%n+1;
N[z].Xue-=R;
k[z]=1;
cout<0;i--) if(k[i]==1) DieN(i);
}
return;
}
if((nl<4&&dl>=3)||x==2) {cout<<"烈焰机甲蓄力。"<=3305536) cout<<"第"<=30) Yan(5),cout<<"成就:坚守"<=300) Money=300,Yan(3),cout<0;i--)
{ int b=0;Yan(N[i].Zhong);
if(N[i].Zhong==0) {cout<<"城墙巍然不动。"<=0&&Hub==0&&D[i].Bing==0) R=20+rand()%21,cout<<"步兵开枪了!"<=0&&Hub==0&&D[i].Bing==0) R=10+rand()%21,cout<<"骑兵身形一抖,向前一刺!"<=0&&Hub==0&&D[i].Bing==0) R=40+rand()%21,cout<<"炮兵点火,炮声响彻天际!"<=0&&D[i].Bing==0) cout<<"药兵开始治疗!恢复了第",Jiu(dl);
if(D[i].Zhong==5&&nl>=0&&Hub==0&&D[i].Bing==0) R=70+rand()%21,cout<<"坦克的穿甲弹从炮管口滚滚白烟中冲出!"<=0&&D[i].Bing==0) cout<<"炮灰点燃了",Yan(4),cout<<"炸弹的引信!"<=0&&D[i].Bing==0) {R=490+rand()%21,cout<<"炮灰",Yan(4),cout<<"爆炸!!!",Sleep(500),cout<=0) Yan(5),Bjing(nl,i);
if(D[i].Zhong==9&&nl>=0) Yan(1),Bbing(nl,i);
if(D[i].Zhong==10&&nl>=0) Yan(2),Bdu(nl,i);
if(D[i].Zhong==11&&nl>=0) Yan(3),Bju(nl,dl,i);
if(D[i].Zhong==12&&nl>=0) Yan(4),Byan(nl,i);
if(nl>=0) Sleep(200);Bai();
}
}
for(int j=1;j<=Bao;j++)
{
if(j==2) Yan(4),cout<<"狂暴血清爆发了,炮塔疯狂地发射着子弹!"<0;i--)
{
int b=0;Yan(N[i].Zhong);
if(N[i].Zhong==0) {cout<<"城墙巍然不动。"<0;i--) if(N[i].Hui!=0) N[i].Hui--;
for(int i=nl;i>0;i--) if(N[i].Bing!=0) N[i].Bing--;
for(int i=nl;i>0;i--) if(N[i].Du!=0) N[i].Du--;
for(int i=dl;i>0;i--) if(D[i].Bing!=0) D[i].Bing--;
if(Baodb!=0) Baodb--;if(Biaob!=0) Biaob--;
if(nl<=0)
{
Yan(4);Sleep(2000);system("cls");
cout<=3305536&&dl<=0) return;
if(t<3305536) Mai(Moo);
if(t<3305536&&Moo==0)
{
int u=0;
x: Bai();
Sleep(200);
int y=rand()%11;
if(t<10)
{
if(dl>=2) y=0;
if(y<5) cout<<"没有新敌人出现。"<=5&&y<9) Yan(1),cout<<"呀!来了个步兵!"<=9) Yan(2),cout<<"呀!来了个骑兵!"<=10)
{
if(dl>=2) y=7;
if(y>=7) {cout<<"没有新敌人出现。"<=20)
{
if(dl>=2) y=9;
if(y>=9) {cout<<"没有新敌人出现。"<=30)
{
if(dl>=3) y=10;
if(y>=10) {cout<<"没有新敌人出现。"<=45)
{
if(dl>=nl+1) y=20;
if(y==20) {cout<<"没有新敌人出现。"<60)
{
if(dl>=nl+2) y=20;
if(y==20) {cout<<"没有新敌人出现。"<81)
{
if(dl>=nl+2) y=20;
if(y==20) {cout<<"没有新敌人出现。"<
#include
#include
#include
#include
#include
using namespace std;
const double pi=3.1415926536;
int toint(float a){return ((int)(a*10+5))/10;}
void Color(int a)
{
if(a==0||a==14||a==20) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==1||a==12) 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||a==11) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
if(a==5||a==13) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
if(a==7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==15) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
if(a==16) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
if(a==17) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);
if(a==8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
if(a==6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
if(a==9) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|BACKGROUND_RED|BACKGROUND_GREEN);
}
void SetPos(float x,float y)
{
int xx=toint(x),yy=toint(y);
COORD pos;pos.X=yy*2,pos.Y=xx;SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
struct node
{
int W,W2,S,mS;
float X,Y;
float vx,vy;
float ax,ay;
bool go,boom;
}blt[100001],pig[100001],boo[100001];
int T,yX,yY,Xy,put,K,K2,Sle,What;
int Bot,Pit,Blt,Pig,Sco,pigk,scok;
int m[41][41];
void Cout(int a,int x,int y)
{
if(a==1) SetPos(x,y),Color(5),cout<=2) SetPos(pig[a].X-2,pig[a].Y);cout<<" ",SetPos(pig[a].X-1,pig[a].Y);cout<<" ";
if(pig[a].W==4) SetPos(pig[a].X,pig[a].Y-1),cout<<" ";
if(pig[a].W==5) SetPos(pig[a].X-1,pig[a].Y),cout<<" ",SetPos(pig[a].X-1,pig[a].Y-1),cout<<" ";
}
if(a==2)
for(int i=0;i<=40;i++)
for(int j=0;j<=40;j++)
{
if(i<=18&&m[i][j]==1) SetPos(i,j),Color(7),cout<<"■";
if(m[i][j]>=2&&m[i][j]<=19) SetPos(i,j),Color(5),cout<<"█",m[i][j]++;
if(m[i][j]>19&&m[i][j]<=29) SetPos(i,j),Color(0),cout<<"█",m[i][j]++;
if(m[i][j]==30) SetPos(i,j),Color(0),cout<<" ",m[i][j]=0;
if(m[i][j]>=31&&m[i][j]<=49) SetPos(i,j),Color(0),cout<<"■",m[i][j]++;
if(m[i][j]==50) SetPos(i,j),Color(7),cout<<"■",m[i][j]=1;
}
if(y==666)
{
SetPos(blt[a].X,blt[a].Y);
Color(10+blt[a].W),cout<<"●";
}Color(0);
}
void Go(int a)
{
SetPos(blt[a].X,blt[a].Y);cout<<" ";
blt[a].X+=blt[a].vx/2;blt[a].Y+=blt[a].vy/2;blt[a].vx+=blt[a].ax/2;blt[a].vy+=blt[a].ay/2;
if(blt[a].X>=20) blt[a].X=19;
if(blt[a].X>20||blt[a].Y>38||blt[a].X<0||blt[a].Y<=0) blt[a].go=1;
if(blt[a].W2==1&&blt[a].Y>=Xy) blt[a].go=1,Sle=0;//地跑鸟
if(blt[a].W2==0)
{
for(int i=0;i<=blt[a].vx/2+1;i++)
{
if(blt[a].vx>0&&m[toint(blt[a].X)+i][toint(blt[a].Y)]==1) //上反弹
{
if(blt[a].W!=5) blt[a].boom=1;
blt[a].X=toint(blt[a].X)+i-1,blt[a].Y+=blt[a].vy/2,blt[a].vx=-blt[a].vx*0.4,blt[a].vy=blt[a].vy*0.8;
if(blt[a].W==3) blt[a].ax=0.5;if(blt[a].W==7) blt[a].vx*=2;
if(blt[a].W==10) blt[a].go=1,Bot++,boo[Bot].X=blt[a].X,boo[Bot].Y=blt[a].Y,boo[Bot].S=1,boo[Bot].mS=4;
}
if(blt[a].vx<0&&m[toint(blt[a].X)-i][toint(blt[a].Y)]==1) //下反弹
{
if(blt[a].W!=5) blt[a].boom=1;
blt[a].X=toint(blt[a].X)+i+1,blt[a].Y+=blt[a].vy/2,blt[a].vx=-blt[a].vx,blt[a].vy=blt[a].vy*0.8;
if(blt[a].W==3) blt[a].ax=0.5;if(blt[a].W==7) blt[a].vx*=2;
if(blt[a].W==10) blt[a].go=1,Bot++,boo[Bot].X=blt[a].X,boo[Bot].Y=blt[a].Y,boo[Bot].S=1,boo[Bot].mS=4;
}
}
if(abs(blt[a].vx)<=0.1&&abs(blt[a].vy)<=0.1&&abs(blt[a].ay)<=0.1)
{
blt[a].go=1;
if(blt[a].W==5) Bot++,boo[Bot].X=blt[a].X,boo[Bot].Y=blt[a].Y,boo[Bot].S=1,boo[Bot].mS=4,blt[a].go=1;
}
}
if(blt[a].go==0) Cout(a,0,666);
}
void Kill(int a)
{
if(pig[a].go==0&&pig[a].W!=2&&pig[a].W!=3&&pig[a].Y<16) Cout(a,202,202),pig[a].Y=16;
if(pig[a].go==0&&pig[a].W==4&&pig[a].Y<20) pig[a].W=1;
int R=rand()%50;Cout(a,202,202);
/清除猪猪
pig[a].X+=pig[a].vx/2;pig[a].Y+=pig[a].vy/2;pig[a].vx+=pig[a].ax/2;pig[a].vy+=pig[a].ay/2;
for(int i=-2;i<=pig[a].vx/2+1;i++)
{
if(m[toint(pig[a].X)+i][toint(pig[a].Y)]==1) //上反弹
pig[a].X=toint(pig[a].X)+i-1,pig[a].Y+=pig[a].vy/2,pig[a].vx=-pig[a].vx*0.5,pig[a].vy=pig[a].vy*0.8;
}
for(int i=Blt-10;i<=Blt;i++)
{
if(pig[a].W==5&&blt[i].go==0&&abs(pig[a].X-blt[i].X)<=1&&abs(pig[a].Y-blt[i].Y)<=1) {m[toint(pig[a].X)-1][toint(pig[a].Y)]=2,pig[a].W2++;Sco+=2;break;}
if(pig[a].W==5&&m[toint(pig[a].X)][toint(pig[a].Y)]>=2&&m[toint(pig[a].X)][toint(pig[a].Y)]<30) {m[toint(pig[a].X)-1][toint(pig[a].Y)]=2,pig[a].W2++;Sco+=2;break;}
if(blt[i].go==0&&abs(pig[a].X-blt[i].X)<=1&&abs(pig[a].Y-blt[i].Y)<=1)
{
if(pig[a].W==6) Bot++,boo[Bot].X=pig[a].X,boo[Bot].Y=pig[a].Y,boo[Bot].S=1,boo[Bot].mS=4,blt[i].go=1;
m[toint(pig[a].X)][toint(pig[a].Y)]=2,pig[a].go=1,Pig--,Sco+=10;break;
}
if(m[toint(pig[a].X)][toint(pig[a].Y)]>=2&&m[toint(pig[a].X)][toint(pig[a].Y)]<30)
{
if(pig[a].W==6) Bot++,boo[Bot].X=pig[a].X,boo[Bot].Y=pig[a].Y,boo[Bot].S=1,boo[Bot].mS=4;
pig[a].go=1,Pig--,Sco+=10;break;
}
if((pig[a].W==2||pig[a].W==3)&&blt[i].go==0&&abs(pig[a].X-2-blt[i].X)<=1&&abs(pig[a].Y-blt[i].Y)<=1) {m[toint(pig[a].X)][toint(pig[a].Y)]=2,pig[a].go=1,Pig--,Sco+=10;break;}
if((pig[a].W==2||pig[a].W==3)&&m[toint(pig[a].X-2)][toint(pig[a].Y)]>=2&&m[toint(pig[a].X-2)][toint(pig[a].Y)]<30) {pig[a].go=1,Pig--,Sco+=10;break;}
}
/弄死猪猪
if(pig[a].go==0)
{
if(pig[a].go==0&&pig[a].W!=2&&pig[a].W!=3&&pig[a].Y<16) Cout(a,202,202),pig[a].Y=16;
if(pig[a].go==0&&pig[a].W==4&&pig[a].Y<20) pig[a].W=1;
int Xx=toint(pig[a].X),Xy=toint(pig[a].Y);
if(pig[a].W==6) SetPos(pig[a].X,pig[a].Y),Color(9),cout<<"TN",Color(0);
else{
SetPos(pig[a].X,pig[a].Y),Color(2),cout<<"●";
if((pig[a].W==2||pig[a].W==3)&&pig[a].X>=2) SetPos(pig[a].X-2,pig[a].Y),Color(0),cout<<"○",SetPos(pig[a].X-1,pig[a].Y),cout<<"|";
if(pig[a].W==4) SetPos(pig[a].X,pig[a].Y-1),Color(2),cout<<"﹃";
if(pig[a].W==5)
{
SetPos(pig[a].X-1,pig[a].Y),Color(8);SetPos(pig[a].X-1,pig[a].Y-1),cout<<"▁";
if(pig[a].W2==0)cout<<"▅";if(pig[a].W2==1)cout<<"▃";if(pig[a].W2==2)cout<<"▂";if(pig[a].W2==3) pig[a].W=1,pig[a].W2=0,SetPos(pig[a].X-1,pig[a].Y-1),cout<<" ";
}
}
/输出猪猪
if(pig[a].W==2&&pig[a].X>pig[a].S) pig[a].W=3,pig[a].ax=-0.4,pig[a].vx=1.5;
else if(pig[a].W==3&&pig[a].X<=pig[a].S) pig[a].W=2,pig[a].ax=0.4,pig[a].vx=-1.5;
if((pig[a].W==2||pig[a].W==3)&&(pig[a].Y<=10||pig[a].Y>=38)) pig[a].vy*=-1;
if(pig[a].W==4&&R==0&&pig[a].X==20) pig[a].vx=-((rand()%40)/10);
if(pig[a].W==4)
{
int r=rand()%20;
for(int i=Blt-10;i<=Blt;i++) if(r<=5&&blt[i].go==0&&pig[a].Y-blt[i].Y<=5&&abs(blt[i].X-pig[a].X)<=1.5&&r<5) r=0;
if(r==0)
{
m[toint(pig[a].X)][toint(pig[a].Y)-2]=10;m[toint(pig[a].X)][toint(pig[a].Y)-3]=2;
for(int j=toint(pig[a].Y)-1;j>=toint(pig[a].Y)-5;j--)
{
for(int i=Blt-10;i<=Blt;i++) if(blt[i].go==0&&!(blt[i].W==3&&blt[i].boom==1)&&blt[i].W2==0&&toint(blt[i].Y)==j&&abs(blt[i].X-pig[a].X)<=2) blt[i].vy=-2;
for(int i=Pit-50;i<=Pit;i++) if(pig[i].go==0&&toint(pig[i].Y)==j&&abs(pig[i].X-pig[a].X)<=2) pig[i].vy=-1;
}
}
}
/移动猪猪
if(pig[a].go==0&&pig[a].W!=2&&pig[a].W!=3&&pig[a].Y<16) Cout(a,202,202),pig[a].Y=16;
if(pig[a].go==0&&pig[a].W==4&&pig[a].Y<20) pig[a].W=1;
if(pig[a].X>20||pig[a].Y>38||pig[a].X<0||pig[a].Y<=0) pig[a].go=1,Pig--,Cout(a,202,202);
/清除猪猪
}
}
void Creat(int a,int p)
{
if(a==-1&&p==-1)
{
Blt++;blt[Blt].W=What;blt[Blt].W2=1;
blt[Blt].vy=1;blt[Blt].X=19;blt[Blt].Y=0;blt[Blt].boom=1;
}
else if(a==0&&p==-1)
{
int u=rand()%7+1,U=rand()%30;
if(u>=5) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].ax=0.5,pig[Pit].W=1;
if(u==1) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].vy=0.5,pig[Pit].ax=0.5,pig[Pit].S=rand()%5+7,pig[Pit].W=2;
if(u==2) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].ax=0.5,pig[Pit].W=4;
if(u==3) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].ax=0.5,pig[Pit].W=5;
if(u==4) Pit++,pig[Pit].Y=rand()%15+20,pig[Pit].X=2,pig[Pit].ax=0.5,pig[Pit].W=6;
if(U==1) Bot++,boo[Bot].Y=rand()%13+15,boo[Bot].X=(rand()%4)*3+8,boo[Bot].S=0,boo[Bot].mS=rand()%2+2,boo[Bot].W2=1;
}
else
{
Blt++;blt[Blt].W=What;
if(a==1) blt[Blt].X=yX;blt[Blt].Y=yY;blt[Blt].ax=0.5; //抛物线
blt[Blt].vx=-3.5*sin(p*pi/180);
blt[Blt].vy=3*cos(p*pi/180);
if(p<=45) blt[Blt].vy*=1+(0.33-0.01*(45-p));
if(p>=45) blt[Blt].vy*=1+(0.33-0.01*(p-45));
if(blt[Blt].W==6) blt[Blt].vy*=1.2,blt[Blt].ax=0.4;
}
}
void Boom(int a)
{
if(boo[a].W2==0)
{
int ms=boo[a].mS,s=boo[a].S,x=boo[a].X,y=boo[a].Y;
if(s==ms) return;
for(int i=x-s;i<=x+s;i++)
for(int j=y-s;j<=y+s;j++)
{
float k=(i-x)*(i-x)+(j-y)*(j-y)-s*s;
if(k<=s&&k>=-s&&i<=20&&j<=38&&i>=0&&j>0&&m[i][j]!=1) m[i][j]=2;
}boo[a].S++;
}
if(boo[a].W2==1)
{
int ms=boo[a].mS,s=boo[a].S,x=boo[a].X,y=boo[a].Y;
if(s==ms) return;
if(y-s>10) m[x][y-s]=31-31*(boo[a].W2-1);
if(y+s<40) m[x][y+s]=31-31*(boo[a].W2-1);
boo[a].S++;
}
}
void Move(int a)
{
Color(5);
if(a==-2) SetPos(17,Xy),cout<<" ",SetPos(18,Xy),cout<<" ",SetPos(19,Xy),cout<<" ",SetPos(20,Xy),cout<<" ";
if(a==-1) SetPos(17,Xy),cout<<" ",SetPos(18,Xy),cout<<" ┃ ┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),cout<<" ▏";
if(a==0) SetPos(18,Xy),cout<<" ┃",Color(What+10),cout<<"●",Color(5),cout<<"┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),cout<<" ▏";
if(a==1) SetPos(18,Xy),cout<<" ",Color(What+10),cout<<"●",Color(5),cout<<" ┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),cout<<" ▏";
if(a==2) SetPos(18,Xy),Color(What+10),cout<<"●",Color(5),cout<<"┃ ┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),cout<<" ▏";
if(a==3) SetPos(18,Xy),cout<<" ┃ ┃",SetPos(19,Xy),Color(What+10),cout<<"●",Color(5),cout<<"╰┳╯",SetPos(20,Xy),cout<<" ▏";
if(a==4) SetPos(18,Xy),cout<<" ┃ ┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),Color(What+10),cout<<"●",Color(5),cout<<" ▏";
if(a==5) SetPos(18,Xy),cout<<" ┃ ┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),cout<<" ",Color(What+10),cout<<"●",Color(5),cout<<" ▏";
if(a==6) SetPos(18,Xy),cout<<" ┃ ┃",SetPos(19,Xy),cout<<" ╰┳╯",SetPos(20,Xy),cout<<" ",Color(What+10),cout<<"●",Color(5),cout<<" ";
Color(0);
}
void Start()
{
char g;Color(5);system("cls");
SetPos(1,1);cout<<"------- 愤 怒 的 小 胎 -------";Color(0);
SetPos(3,1);cout<<"空格瞄准,按X触发小胎技能,←→移动弹弓";
SetPos(5,1);cout<<"猪猪技能自动触发,空中会有墙出现。";
SetPos(7,1);cout<<"危险值由命中率,猪的存活时间计算!";
SetPos(9,1);cout<<"危险值点满后失败!1500分通关!";
SetPos(1,20);cout<<"-------- 小 胎 技 能 --------";
SetPos(3,20);Color(11),cout<<"●",Color(0),cout<<":无技能";
SetPos(5,20);Color(12),cout<<"●",Color(0),cout<<":分身!不同分身初速度大小相同,";
SetPos(6,20);cout<<" 方向不同。";
SetPos(7,20);Color(13),cout<<"●",Color(0),cout<<":加速!以当前速度做匀速直线运动,";
SetPos(8,20);cout<<" 且免疫狙击猪的冲击。";
SetPos(9,20);Color(14),cout<<"●",Color(0),cout<<":投蛋!并获得向上速度做匀速直线";
SetPos(10,20);cout<<" 运动,快达可以穿墙。";
SetPos(11,20);Color(15),cout<<"●",Color(0),cout<<":爆炸!";
SetPos(13,20);Color(16),cout<<"●",Color(0),cout<<":回旋!开始做向左加速运动!发射";
SetPos(14,20);cout<<" 时获得双倍水平速度。";
SetPos(15,20);Color(17),cout<<"●",Color(0),cout<<":[被动] 弹跳力为普通鸟三倍。发射";
SetPos(16,20);cout<<" 时获得1.5倍水平、竖直速度。";
SetPos(11,1);cout<<"-------- 猪 猪 技 能 --------";
SetPos(13,2);Color(2),cout<<"●",Color(0),cout<<":无技能";
SetPos(14,1);Color(8),cout<<"▁▅";
SetPos(15,2);Color(2),cout<<"●",Color(0),cout<<":防御力为普通猪三倍";
SetPos(16,2);cout<<"○";
SetPos(17,2);cout<<"│:做空中简谐运动,受死范围";
SetPos(18,2);Color(2),cout<<"●",Color(0),cout<<" 为普通猪两倍。";
SetPos(19,2);cout<<" 有几率跳起或发射冲击波,冲";
SetPos(20,1);Color(2),cout<<"﹃●",Color(0),cout<<":开小胎与同类,可以引爆TNT!";
SetPos(18,20);Color(5),cout<<"按 y 开始游戏!";
A:if(kbhit()) g=_getch();
if(g!='y') goto A;
}
int main()
{
system("mode con cols=79 lines=22");
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
srand((unsigned)time(NULL));St:Start();system("cls");
memset(blt,0,sizeof(blt));memset(pig,0,sizeof(pig));
memset(boo,0,sizeof(boo));memset(m,0,sizeof(m));
T=put=K=K2=Sle=What=Pig=Sco=0;pigk=scok=-1;
Xy=4,yX=18,yY=6;Blt=20,Bot=20,Pit=60;Color(7);
SetPos(19,14);cout<<"■";
SetPos(20,13);cout<<" █▍";m[19][14]=m[20][13]=m[20][14]=1;
SetPos(21,0);for(int i=0;i<39;i++) cout<<"■",m[21][i]=1;
Color(0);What=rand()%5+1;
while(1)
{
if(Sco>=1500) break;
T++;K=0;Color(0);
if(Sco!=scok) SetPos(1,1),cout<<"分数:"<18) break;Pig-=aa;}
scok=Sco;pigk=Pig;
if(GetAsyncKeyState(VK_LEFT)&0x8000&&Xy>0) Move(-2),Xy--,K=1;
if(GetAsyncKeyState(VK_RIGHT)&0x8000&&Xy<10) Move(-2),Xy++,K=1;
if(K==1)
{
if(put==0&&Sle==0) Move(0);
else Move(-1);
}
if(kbhit())
{
char g=_getch();
if(g=='x'||g=='X')
{
for(int i=Blt-10;i<=Blt;i++)
if(blt[i].go==0&&blt[i].boom==0&&blt[i].W!=1&&blt[i].W!=7)
{
blt[i].boom=1;
if(blt[i].W==2)
{
Blt++;blt[Blt].W=2;blt[Blt].vy=blt[i].vy*1.2;blt[Blt].vx=blt[i].vx+1;
blt[Blt].ax=blt[i].ax;blt[Blt].X=blt[i].X;blt[Blt].Y=blt[i].Y;blt[Blt].boom=1;
Blt++;blt[Blt].W=2;blt[Blt].vy=blt[i].vy*0.7;blt[Blt].vx=blt[i].vx-1;
blt[Blt].ax=blt[i].ax;blt[Blt].X=blt[i].X;blt[Blt].Y=blt[i].Y;blt[Blt].boom=1;
}
if(blt[i].W==3) blt[i].vy=fmax(blt[i].vy*1.5,2.5),blt[Blt].vx+=1,blt[i].ax=0;
if(blt[i].W==4)
{
blt[i].vx=-3;blt[i].ax=0.1;Blt++;blt[Blt].boom=1;blt[Blt].W=10;
blt[Blt].X=blt[i].X;blt[Blt].Y=blt[i].Y;blt[Blt].ax=blt[i].ax,blt[Blt].vx=1;
}
if(blt[i].W==5) Bot++,boo[Bot].X=blt[i].X,boo[Bot].Y=blt[i].Y,boo[Bot].S=1,boo[Bot].mS=5,blt[i].go=1;
if(blt[i].W==6) blt[i].ay=-1,blt[i].ax=0.3,blt[i].vx=min(blt[i].vx/2,(float)0);
break;
}
}
}
if(GetAsyncKeyState(' ')&0x8000&&K==0&&Sle==0)
{
if(put<=5) Move(1),yX=18,yY=Xy+1;
else if(put<=20) Move(2),yX=18,yY=Xy;
else if(put<=40) Move(3),yX=19,yY=Xy;
else if(put<=60) Move(4),yX=20,yY=Xy;
else if(put<=80) Move(5),yX=20,yY=Xy+1;
else Move(6),yX=20,yY=Xy+2;
if(put==0) K2=1;if(put==90) K2=-1;
if(K2==1) put+=min(rand()%7+1,90-put);
if(K2==-1) put-=min(rand()%7+1,put);
Cout(1,17,Xy+2);
}
if((!(GetAsyncKeyState(' ')&0x8000)&&(put!=0))||(put!=0&&K==1))
Move(-1),Creat(1,put),put=0,yX=18,yY=5,Sle=1,What=rand()%7+1,Creat(-1,-1),Sco=max(Sco-5,0);
for(int i=Blt-10;i<=Blt;i++) if(blt[i].go==0) Go(i);
for(int i=Bot-10;i<=Bot;i++) if(boo[i].go==0) Boom(i),Cout(2,0,0);
for(int i=Pit-50;i<=Pit;i++) if(pig[i].go==0) Kill(i);
if(Sle!=0) Move(-1);
else if(put==0) Move(0);
if(T%300==0) system("cls"),pigk=scok=-1;
if(T%100==0)
{
Color(7);
for(int i=0;i<=18;i++)
for(int j=0;j<=40;j++) if(m[i][j]==1&&T%100==0) SetPos(i,j),cout<<"■";
SetPos(19,14),cout<<"■",SetPos(20,13),cout<<" █▍";
SetPos(21,0);for(int i=0;i<39;i++) cout<<"■";Color(0);
}
if(T%min(50,(2000-Sco)/30)==0) Pig++,Creat(0,-1);
Sleep(30);
}
if(Sco<1500) {SetPos(9,17);system("color 7F");Color(11);cout<<"YOU DIE !";}
else {SetPos(9,17);system("color 6E");Color(5);cout<<"YOU WIN !";}
SetPos(11,16);Sleep(1000);cout<<"play again? (y/n)";Sleep(1000);char g;
A:if(kbhit()) g=_getch();SetPos(18,0);
if(g=='n') return 0;
else if(g!='y') goto A;
else if(g=='y') goto St;
}
由于东西太多了,下期继续出
如果你对我感兴趣的话,就关注我吧(づ ̄3 ̄)づ╭❤~