devc++弹幕小游戏字符头新版

#include
#include
#include
#include
#include
#include
#include
#include
#include 
#include 
#include
#include
#include
#include 
#include 
#include 
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
bool gd=false;
bool zd=false;
int HP=3;
int Boss_HP;
int x=10;
int y=1;
int k=1;
int kx=2,ky=2;
int qh=1;
int ny;
char js;
int pj=20;
//剧情:滚石(可招架)》水枪》喷火》墓室探险(可招架)》激光(可招架)》加强激光(可招架)
//粉色可招架,其他用子弹打穿。
int x_what(int x) {//取随机数
	srand((unsigned)time(NULL));
	return( rand() % x);
}
int go_to_next_ground() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN);
	cout<<"+++"<=15) {
		cout<<"评价:S";
	}
	if(pj>=10&&pj<15) {
		cout<<"评价:A";
	}
	if(pj>=5&&pj<10) {
		cout<<"评价:B";
	}
	if(pj<=5) {
		cout<<"评价:C";
	}
}
int wl() {
	if(x<10) {
		x++;
	}
}
int out() {
	system("cls");
	cout<<"HP:"<30) {
					SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
					cout<<"*";
				} else {
					SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE | FOREGROUND_RED);
					cout<<"*";
				}
			} else if(zd==true&&j==ny&&(i=30) {
		if(k==y) {
			if(!zd) {
				HP--;
				k++;
			}
		}
		k=x_what(10);
		k++;
	} else {
		if(k==y) {
			if(!gd) {
				HP--;
				k++;
			}
		}
		k=x_what(10);
		k++;
	}
}
int m5() {
	if(Boss_HP>=40) {
		if(k==x) {
			HP--;
		}
		if(k<10) {
			k++;
		} else {
			k=1;
		}
	} else {
		if(k==x) {
			HP--;
		}
		if(k<10) {
			k++;
		} else {
			k=3;
		}
	}
}
int out2() {
	system("cls");
	cout<<"HP:"<=20) {
		if(kx==x&&ky==y) {
			if(!gd) {
				HP--;
			}
		}
		if(kx==10&&ky==10) {
			kx=1;
			ky=1;
		}
		kx++;
		ky++;
	} else {
		if(kx==x&&ky==y) {
			if(!gd) {
				HP--;
			}
		}
		if(kx==10) {
			kx=1;
			ky=y;
		}
		kx++;
	}
}
int m_fly() {
	if(Boss_HP>=30) {
		if(kxx) {
			kx--;
		} else if(ky>y) {
			ky--;
		}
		if(kx==x&&ky==y) {
			kx=1;
			ky=x_what(10);
			ky++;
			if(!zd) {
				HP--;
			}
		}
	} else {
		if(kxx) {
			kx--;
		} else if(ky>y) {
			ky--;
		}
		if(kx==x&&ky==y) {
			kx=1;
			ky=y;
			if(!zd) {
				HP--;
			}
		}
	}
}
int m_qp() {
	if(Boss_HP>150) {
		if((x==kx&&y==ky)&&(!zd)) {
			HP--;
		}
		if(x==kx&&y==ky) {
			kx=1;
			ky=1;
		}
		if(kx==10) {
			kx=1;
			ky=x_what(10);
			ky++;
		}
		kx++;
	} else {
		if((x==kx&&y==ky)&&(!zd)) {
			HP--;
		}
		if(ky==1) {
			kx=10;
			ky=10;
			ky++;
		}
		ky--;
	}
}
int mdle() {
	if(Boss_HP>=300) {
		if(kxx) {
			kx--;
		} else if(ky>y) {
			ky--;
		}
		if(kx==x&&ky==y) {
			kx=1;
			ky=x_what(10);
			ky++;
			if(!gd) {
				HP--;
			}
		}
	} else {
		if(kxx) {
			kx--;
		} else if(ky>y) {
			ky--;
		}
		if(kx==x&&ky==y) {
			kx=1;
			ky=y;
			if(!gd) {
				HP--;
			}
		}
	}
}
int out7() {
	system("cls");
	cout<<"1P:w跳跃,ad(x)移动,s攻击,e招架(防粉色攻击),2P:i跳跃,jl(m)移动,k攻击,u招架(防粉色攻击)。"<4) {
			HP=3;
		}
		if(x<1) {
			x=1;
		}
		Sleep(100);
	}
}
int Boss() {
	HP=3;
	Boss_HP=120;
	x=10;
	y=1;
	k=0;
	kx=0;
	ky=0;
	while(true) {
		out();
		play();
		m();
		if(Boss_HP<=0) {
			return 0;
		}
		if(HP==0) {
			return 0;
		}
		if(HP>4) {
			HP=3;
		}
		if(x<1) {
			x=1;
		}
		qh++;
		wl();
		Sleep(100);
	}
}
int Boss2() {
	HP=3;
	Boss_HP=250;
	x=10;
	y=1;
	k=0;
	kx=0;
	ky=0;
	while(true) {
		out2();
		play2();
		m2();
		if(Boss_HP<=0) {
			return 0;
		}
		if(HP==0) {
			return 0;
		}
		if(HP>4) {
			HP=3;
		}
		if(x<1) {
			x=1;
		}
		wl();
		Sleep(100);
	}
}
int Boss3() {
	HP=3;
	x=10;
	y=1;
	Boss_HP=60;
	kx=1;
	ky=1;
	while(true) {
		out3();
		play3();
		m3();
		if(Boss_HP<=0) {
			return 0;
		}
		if(HP==0) {
			return 0;
		}
		if(HP>4) {
			HP=3;
		}
		if(x<1) {
			x=1;
		}
		Sleep(100);
	}
}
int Boss_fly() {
	HP=3;
	x=10;
	y=1;
	Boss_HP=70;
	kx=1;
	ky=1;
	while(true) {
		out_fly();
		play_fly();
		m_fly();
		if(Boss_HP<=0) {
			return 0;
		}
		if(HP==0) {
			return 0;
		}
		if(HP>4) {
			HP=3;
		}
		if(x<1) {
			x=1;
		}
		Sleep(100);
	}
}
int Boss_qp() {
	HP=3;
	x=10;
	y=1;
	Boss_HP=400;
	kx=1;
	ky=1;
	while(true) {
		out_qp();
		play();
		m_qp();
		if(Boss_HP<=0) {
			return 0;
		}
		if(HP==0) {
			return 0;
		}
		if(HP>4) {
			HP=3;
		}
		if(x<1) {
			x=1;
		}
		wl();
		Sleep(100);
	}
}
int Boss_dle() {
	HP=3;
	x=10;
	y=1;
	Boss_HP=600;
	kx=1;
	ky=1;
	while(true) {
		outdle();
		playdle();
		mdle();
		if(Boss_HP<=0) {
			return 0;
		}
		if(HP==0) {
			return 0;
		}
		if(HP>4) {
			HP=3;
		}
		if(x<1) {
			x=1;
		}
		wl();
		Sleep(100);
	}
}
int Boss4() {
	Boss_HP=500;
	x=10;
	y=1;
	k=0;
	kx=0;
	ky=0;
	while(true) {
		out_end();
		play2();
		m_end();
		if(Boss_HP<=0) {
			return 0;
		}
		if(HP==0) {
			return 0;
		}
		if(HP>4) {
			HP=3;
		}
		if(x<1) {
			x=1;
		}
		wl();
		Sleep(100);
	}
}
int Boss5() {
	HP=3;
	Boss_HP=120;
	x=10;
	y=1;
	k=0;
	kx=0;
	ky=0;
	while(true) {
		out5();
		play5();
		m5();
		if(Boss_HP<=0) {
			return 0;
		}
		if(HP==0) {
			return 0;
		}
		if(HP>4) {
			HP=3;
		}
		if(x<1) {
			x=1;
		}
		qh++;
		wl();
		Sleep(200);
	}
}
int out6() {
	system("cls");
	cout<<"HP:"<4) {
			HP=3;
		}
		if(x<1) {
			x=1;
		}
		if(HP==4) {
			return 0;
		}
		wl();
		Sleep(500);
	}
}
int story_dle() {
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN);
	system("cls");
	cout<<"打败骰子王后,字符头和字母人又飘了,老是去美杜莎的领海里搞破坏。";
	Sleep(2000);
	system("cls");
	cout<<"美杜莎:哎,又来了......";
	Sleep(2000);
	system("cls");
}
int story_fir() {
	system("cls");
	cout<<"一天,字符头和字母人贪玩,偷偷外出,到墨池岛赌场,结果惹到了不该惹的人。";
	Sleep(2000);
	system("cls");
	cout<<"数字公公:我都说了,你们不要上墨池岛,惹了上面的人,神仙都救不了!你现在只能收集灵魂契约,才能还债。";
	Sleep(2000);
	system("cls");
	cout<<"并且,你获得见骰子王的机会后,只能把他和他的助手桥牌消灭掉,他们都是邪恶的逃犯。";
	Sleep(2000);
	system("cls");
	cout<<"数字公公:还有,打败外星人可以拿到激光枪,打败桥牌拿到连发巴雷特。";
	Sleep(2000);
	system("cls");
}
int story_mid() {
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN);
	system("cls");
	cout<<"新手教程结束!";
	Sleep(2000);
	system("cls");
}
int story_over() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN);
	cout<<"最后,字符头兄弟解决了骰子王,回到了家。";
	Sleep(2000);
	system("cls");
	cout<<"字符头兄弟:数字公公,我们解决掉墨池岛赌场的骰子王啦。";
	Sleep(2000);
	system("cls");
}
int story0() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN);
	cout<<"新手教程...";
	Sleep(2000);
	system("cls");
}
int story1() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN);
	cout<<"陨石访客:去死吧!";
	Sleep(2000);
	system("cls");
	cout<<"来自行星的生命...";
	Sleep(2000);
	system("cls");
}
int story2() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN);
	cout<<"水上飞人:颤抖吧字符头,我是最强大的!";
	Sleep(2000);
	system("cls");
	cout<<"字符头兄弟:让你尝尝激光的滋味!";
	Sleep(2000);
	system("cls");
	cout<<"水上乐园...";
	Sleep(2000);
	system("cls");
}
int story3() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN);
	cout<<"骰子王:你收集了所有灵魂契约,不过,你还要和我玩个小游戏!";
	Sleep(2000);
	system("cls");
	cout<<"字符头兄弟:让你尝尝连发巴雷特的滋味!";
	Sleep(2000);
	system("cls");
	cout<<"孤注一掷...";
	Sleep(2000);
	system("cls");
}
int story4() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
	cout<<"骰子王:切,劳资才没这么弱!";
	Sleep(2000);
	system("cls");
}
int story5() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN);
	cout<<"房顶上的纵火犯:我是无敌的!";
	Sleep(2000);
	system("cls");
	cout<<"火灾现场...";
	Sleep(2000);
	system("cls");
}
int story_qp() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN);
	cout<<"桥牌:想见老板,先打败我!";
	Sleep(2000);
	system("cls");
	cout<<"赌场追凶...";
	Sleep(2000);
	system("cls");
}
int story_fly() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN);
	cout<<"血月...";
	Sleep(2000);
	system("cls");
}
int story6() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN);
	HP=1;
	cout<<"字符头兄弟:奇怪,我怎么有点不舒服?";
	Sleep(2000);
	system("cls");
	cout<<"墓室探险...";
	Sleep(2000);
	system("cls");
}
int story7() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN);
	cout<<"字符头兄弟:终于舒服些了";
	Sleep(2000);
	system("cls");
	cout<<"探险结束...";
	Sleep(2000);
	system("cls");
}
int main() {
	system("cls");
	int ms;
	char ms2;
	char js2;
	open();
	system("cls");
	cout<<"输入1:1P字符头(wasde),2:2P字母人(ijklu)";
	while(js2!='1'&&js2!='2') {
		while(!kbhit()) {

		}
		js2=getch();
		if(js2=='1') {
			js='8';
		}
		if(js2=='2') {
			js='Y';
		}
	}
	system("cls");
	cout<<"输入a随机模式,s闯关模式,d键DLE模式";
	while(ms2!='a'&&ms2!='s'&&ms2!='d') {
		while(!kbhit()) {

		}
		ms2=getch();
	}
	system("cls");
	story0();
	new_player();
	HP=3;
	story_mid();
	system("cls");
	if(ms2=='a') {
		system("cls");
		cout<<"随机挑战...";
		Sleep(2000);
		system("cls");
		ms=x_what(5);
		while(true) {
			if(ms==0) {
				Boss3();
			}
			if(ms==1) {
				Boss();
			}
			if(ms==2) {
				Boss2();
			}
			if(ms==3) {
				Boss5();
			}
			if(ms==4) {
				Boss_dle();
			}
			if(HP<=0) {
				system("cls");
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
				cout<<"这都打不过?";
				Sleep(2000);
				system("cls");
				pj--;
			} else {
				system("cls");
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED|FOREGROUND_GREEN);
				cout<<"打败Boss!"<

你可能感兴趣的:(字符头,c++,游戏,bug)