DEVC++第五人格V2.0

//第五人格(1P咒术师人机屠夫)
#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;
int game_map[20][20];
int go;//判断监管是否能走
int dj;//密码机
int dj2;
int dj3;
int knife;//擦刀 
bool ch_yn=false;//上椅子 
int chair=0;//挣扎 
int fly_t=60;//飞天时间 
int dm;//大门
int x,y;//我的坐标
int HP=2;//血量
int dx,dy;//敌方坐标
int ds;//敌方被麻痹
int jns;//技能数量
int jl[4];//电机距离,用于指示寻找电机
int open() {
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
	cout<<"----------"<=20){
		chair=0;
		ch_yn=false;
		HP=2;
	}
}
bool xt() {
	if((x-dx<=6&&x-dx>=0)||(dx-x<=6&&dx-x>=0)) {
		return true;
	}
	else if((y-dy<=6&&y-dy>=0)||(dy-y<=6&&dy-y>=0)) {
		return true;
	}
	else{
		return false;
	}
}
int out() {
	system("cls");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
	cout<<"技能:"<0){
		knife--;
		return 0;
	}
	if(ds>0) {
		ds--;
		return 0;
	}
	if(go%7!=0) {
		return 0;
	}
	if(x==dx&&y==dy&&knife==0&&HP>0) {
		HP--;
		knife=15;
	}
	if(dx0) {
		dx++;
	} else if(dx>x&&dx>-1&&HP>0) {
		dx--;
	} else if(dy>y&&dy>-1&&HP>0) {
		dy--;
	} else if(dy0) {
		dy++;
	}

}
int play() {
	char c;
	if(kbhit()) {
		c=getch();
		if(c=='w'&&x>0&&HP>0) {
			x--;
		}
		if(c=='a'&&y>0&&HP>0) {
			y--;
		}
		if(c=='s'&&x<19&&HP>0) {
			x++;
		}
		if(c=='d'&&y<19&&HP>0) {
			y++;
		}
		if(c=='q'&&x==4&&y==9&&dj<15) {
			dj++;
		}
		if(c=='q'&&x==9&&y==9&&dj2<15) {
			dj2++;
		}
		if(c=='q'&&x==14&&y==9&&dj3<15) {
			dj3++;
		}
		if(c=='q'&&x==9&&y==19&&dj>=15&&dj2>=15&&dj3>=15) {
			dm++;
		}
		if(c=='q'&&HP==0){
			chair++;
		}
		if(c=='q'&&x==9&&y==0&&jns<5) {
			jns++;
			if(HP<2){
				HP++;
			}
		}
		if(c=='e'&&jns>0) {
			jns--;
			ds+=10;
		}
	}
}
int main() {
	open();
	first();
	while(true) {
		jl[0]=0;
		jl[1]=0;
		jl[2]=0;
		jl[3]=0;
		if(dj<15) {
			jl[0]+=jdz(x-4);
			jl[0]+=jdz(y-9);
		} else {
			jl[0]=999999;
		}
		if(dj2<15) {
			jl[1]+=jdz(x-9);
			jl[1]+=jdz(y-9);
		} else {
			jl[1]=999999;
		}
		if(dj3<15) {
			jl[2]+=jdz(x-14);
			jl[2]+=jdz(y-9);
		} else {
			jl[2]=999999;
		}
		jl[3]+=jdz(x-9);
		jl[3]+=jdz(y-19);
		out();
		play();
		AI();
		ch_up(); 
		if(dm>=5) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
			system("cls");
			cout<<"逃脱";
			Sleep(2000);
			system("cls");
			return 0;
		}
		if(fly_t<=0) {
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
			system("cls");
			cout<<"迷失";
			Sleep(2000);
			system("cls");
			return 0;
		}
		Sleep(200);
	}
}

你可能感兴趣的:(c++,开发语言,游戏)