【c++】小心3.0

58 篇文章 39 订阅

更新了一张地图

更新了电池([])

打开门要三颗电池

很多物品都改了样子

上方显示玩家状态

游戏剧情:

你发现这一层的东西都改了样子

你找到了大门

发现要3颗电池才能打开

#undef UNICODE
#undef _UNICODE
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>
#include <ctime>
#include <windows.h>
#include <conio.h>
#include <fstream>
#include <stdio.h>
using namespace std;
namespace _game
{
	
	//常量
	const long long ESC = 27,
		Enter = 13,
		Tab = 9,
		Shang = 38,
		Xia = 40,
		Zuo = 37,
		You = 39,
		Kong = ' ',
		z_sb = VK_LBUTTON,
		y_sb = VK_RBUTTON,
		Shift = VK_SHIFT,
		z_Shift = VK_LSHIFT,
		y_Shift = VK_RSHIFT,
		Ctrl = VK_CONTROL,
		z_Ctrl = VK_LCONTROL,
		y_Ctrl = VK_RCONTROL,
		Alt = VK_MENU,
		z_Alt = VK_LMENU,
		y_Alt = VK_RMENU,
		A = 'A',
		B = 'B',
		C = 'C',
		D = 'D',
		E = 'E',
		F = 'F',
		G = 'G',
		H = 'H',
		I = 'I',
		J = 'J',
		K = 'K',
		L = 'L',
		M = 'M',
		N = 'N',
		O = 'O',
		P = 'P',
		Q = 'Q',
		R = 'R',
		S = 'S',
		T = 'T',
		U = 'U',
		V = 'V',
		W = 'W',
		X = 'X',
		Y = 'Y',
		Z = 'Z';
	
	//结构体
	struct cdhs//存档结构体
	{
		void out(int n, string name)//输出存档
		{
			ofstream cd(&name[0]);
			cd << n;
			return;
		}
		void out(long long n, string name)
		{
			ofstream cd(&name[0]);
			cd << n;
			return;
		}
		void out(bool n, string name)
		{
			ofstream cd(&name[0]);
			cd << n;
			return;
		}
		void out(char n, string name)
		{
			ofstream cd(&name[0]);
			cd << n;
			return;
		}
		void out(string n, string name)
		{
			ofstream cd(&name[0]);
			cd << n;
			return;
		}//重载
		void in(int& n, string name)//读入存档
		{
			ifstream cd(&name[0]);
			cd >> n;
			return;
		}
		void in(long long& n, string name)
		{
			ifstream cd(&name[0]);
			cd >> n;
			return;
		}
		void in(bool& n, string name)
		{
			ifstream cd(&name[0]);
			cd >> n;
			return;
		}
		void in(char& n, string name)
		{
			ifstream cd(&name[0]);
			cd >> n;
			return;
		}
		void in(string& n, string name)
		{
			ifstream cd(&name[0]);
			cd >> n;
			return;
		}//重载 
	};
	struct hl//行列
	{
		long long h, l;
	};
	
	//函数
	bool axj(long long key)
	{
		return (GetKeyState(key) < 0);
	}
	void bout(string n, long long s = 50, bool f = 0, char key = 13)//输出
	{
		for (long long i = 0; i < n.size(); i++)
		{
			if (f && GetKeyState(key) < 0)
			{
				cout << n.substr(i, n.size());
				return;
			}
			cout << n[i];
			Sleep(s);
		}
		return;
	}
	void ckbb()//查看当前b_game.h库版本信息
	{
		system("cls");
		cout << "库名:b_game.h\n";
		cout << "类型:拓展库\n";
		cout << "版本号:2.0.1\n";
		return;
	}
	void gs(long long h, long long l, string z)//格式
	{
		for (long long i = 1; i <= h; i++)
			cout << "\n";
		for (long long i = 1; i <= l; i++)
			cout << " ";
		cout << z;
		return;
	}
	hl sbwz(bool x = 1, bool n = 1)//鼠标位置
	{
		HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
		HWND h = GetForegroundWindow();
		CONSOLE_FONT_INFO consoleCurrentFont;
		hl hl;
		POINT p;
		if (x)
		{
			GetCursorPos(&p);
			ScreenToClient(h, &p);
		}
		else
		{
			GetCursorPos(&p);
		}
		if (n)
		{
			GetCurrentConsoleFont(hOutput, FALSE, &consoleCurrentFont);
			p.x /= consoleCurrentFont.dwFontSize.X;
			p.y /= consoleCurrentFont.dwFontSize.Y;
		}
		hl.h = p.y + 1;
		hl.l = p.x + 1;
		return hl;
	}
	void yanse(int n)//颜色
	{
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), n);
		return;
	}
	void ycbj()//移除快速编辑模式
	{
		HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
		DWORD mode;
		GetConsoleMode(hStdin, &mode);
		mode &= ~ENABLE_QUICK_EDIT_MODE;
		SetConsoleMode(hStdin, mode);
		return;
	}
	void ycgb()//隐藏光标
	{
		CONSOLE_CURSOR_INFO cursor;
		cursor.bVisible = FALSE;
		cursor.dwSize = sizeof(cursor);
		HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
		SetConsoleCursorInfo(handle, &cursor);
		return;
	}
	void ydgb(long long h, long long l)//移动光标
	{
		COORD pos = { l - 1,h - 1 };
		HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
		SetConsoleCursorPosition(hOut, pos);
		return;
	}
}
using namespace _game;
//常量
const string yz_ren = "●",
yz_fk = "■",
yz_sdt = "★",
yz_gw = "◆",
yz_kong = "  ",
yz_zd = "¤",
yz_dz = "[]";
const long long dts = 3,
gws = 2,
dcs = 3,
ys_ren = 249,
ys_fk = 240,
ys_sdt = 249,
ys_gw = 244,
ys_kong = 240,
ys_zd = 249,
ys_dz = 249;
const short dt[dts + 1][41][41] = {
	{
		0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
		0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
		0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
		0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
		0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
		0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
		0,1,1,1,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0;
bool cx_flag = 1;
struct wp
{
	long long h, l;
	void csh()
	{
		h = rand() % 40 + 1;
		l = rand() % 40 + 1;
		while (dt[dtbh][h][l] != 0)
		{
			h = rand() % 40 + 1;
			l = rand() % 40 + 1;
		}
		return;
	}
};
struct ren : wp
{

}wj;
struct dc : wp
{
	bool f = 1;
}dc[dcs + 1];
struct sdt : wp
{
	bool f = 1;
}sdt;
struct zd : wp
{

}zd;
struct gw : wp
{
	short fx, dh[5] = { 0,-1,1,0,0 }, dl[5] = { 0,0,0,-1,1 }, f = 0;
	void csh()
	{
		h = rand() % 40 + 1;
		l = rand() % 40 + 1;
		while (dt[dtbh][h][l] != 0)
		{
			h = rand() % 40 + 1;
			l = rand() % 40 + 1;
		}
		return;
	}
	void xz()
	{
		long long dh[5] = { 0,-1,1,0,0 }, dl[5] = { 0,0,0,-1,1 };
		for (long long i = 1; i <= 4; i++)
		{
			long long hh = h, ll = l;
			while (dt[dtbh][hh][ll] != 1)
			{
				if (hh == wj.h && ll == wj.l)
				{
					fx = i;
					f = 1;
					break;
				}
				hh += dh[i];
				ll += dl[i];
			}
		}
		if (f)
		{
			if (dt[dtbh][h + dh[fx]][l + dl[fx]] == 1)
			{
				f = 0;
			}
			else
			{
				h += dh[fx], l += dl[fx];
			}
		}
		else
		{
			long long t;
			t = rand() % 4 + 1;
			while (dt[dtbh][h + dh[t]][l + dl[t]] == 1)t = rand() % 4 + 1;
			h += dh[t];
			l += dl[t];
		}
	}
}gw[gws + 1];
void csh();
void out();
void in();
void bd();
int main()
{
	srand(time(0));
	yanse(240);
	system("cls");
	system("mode con cols=81 lines=41");
	system("title 小心");
	ycgb();
	cout << "正在加载...";
	dtbh = rand() % dts + 1;
	csh();
	//
	system("cls");
	ydgb(1, 1);
	for (long long i = 1; cx_flag; i++)
	{
		long long time_ = clock();
		if (i % 1 == 0)out();
		if (i % 1 == 0)in();
		if (i % 1 == 0)bd();
		for (long long j = 1; j <= gws; j++)
		{
			if (i % 2 == 0)
				gw[j].xz();
			else
				break;
		}
		if (i % 2 == 0)bd();
		if (cx_flag == 0)return 0;
		Sleep(150 - (clock() - time_));
		yanse(7);
	}
	return 0;
}
void csh()
{
	wj.csh();
	sdt.csh();
	zd.csh();
	for (long long i = 1; i <= gws; i++)
		gw[i].csh();
	for (long long i = 1; i <= dcs; i++)
		dc[i].csh();
	return;
}
void out()
{
	bool flag = 1;
	yanse(7);
	system("cls");
	yanse(7);
	ydgb(1, 1);
	cout << "生命:" << 1 << " " << "电池数:" << wj_dcs << " " << "是否有手电筒(Y/N):";
	if (!sdt.f)
	{
		cout << "Y";
	}
	else
	{
		cout << "N";
	}
	for (long long i = wj.h - ksd; i <= wj.h + ksd; i++)
	{
		for (long long j = wj.l - ksd; j <= wj.l + ksd; j++)
		{
			flag = 1;
			ydgb(i + 1, j * 2 - 1);
			if (i < 1 || j < 1 || i>40 || j>40)
			{
				continue;
			}
			else
			{
				for (long long k = 1; k <= gws; k++)
					if (i == gw[k].h && j == gw[k].l)
					{
						yanse(ys_gw);
						cout << yz_gw;
						flag = 0;
					}
			}
			if (!flag)
			{
				continue;
			}
			for (long long k = 1; k <= dcs; k++)
			{
				if (i == dc[k].h && j == dc[k].l && dc[k].f)
				{
					yanse(ys_dz);
					cout << yz_dz;
					flag = 0;
				}
			}
			if (!flag)
			{
				continue;
			}
			if (i == wj.h && j == wj.l)
			{
				yanse(ys_ren);
				cout << yz_ren;
			}
			else
				if (i == zd.h && j == zd.l)
				{
					yanse(ys_zd);
					cout << yz_zd;
				}
				else
					if (i == sdt.h && j == sdt.l && sdt.f)
					{
						yanse(ys_sdt);
						cout << yz_sdt;
					}
					else

						if (dt[dtbh][i][j] == 1)
						{
							yanse(ys_fk);
							cout << yz_fk;
						}
						else
						{
							yanse(ys_kong);
							cout << yz_kong;
						}
		}
	}
	return;
}
void bd()
{
	for (long long i = 1; i <= dcs; i++)
	{
		if (dc[i].h == wj.h && dc[i].l == wj.l && dc[i].f)
		{
			dc[i].f = 0;
			wj_dcs++;
		}
	}
	if (wj.h == sdt.h && wj.l == sdt.l && sdt.f)
	{
		sdt.f = 0;
		ksd = 5;
	}
	for (long long i = 1; i <= gws; i++)
		if (wj.h == gw[i].h && wj.l == gw[i].l)
		{
			yanse(240);
			system("cls");
			cout << "你输了!!!\n\n\n";
			cout << "按Enter继续";
			while (_getch() != 13);
			cx_flag = 0;
			system("cls");
			return;
		}
	if (wj.h == zd.h && wj.l == zd.l && wj_dcs == dcs)
	{
		yanse(240);
		system("cls");
		cout << "你赢了!!!\n\n\n";
		cout << "按Enter继续";
		while (_getch() != 13);
		cx_flag = 0;
		system("cls");
		return;
	}
	return;
}
void in()
{
	if (axj('A') && wj.l - 1 > 1 && dt[dtbh][wj.h][wj.l - 1] == 0)
	{
		wj.l--;
	}
	if (axj('D') && wj.l + 1 < 40 && dt[dtbh][wj.h][wj.l + 1] == 0)
	{
		wj.l++;
	}
	if (axj('W') && wj.h - 1 > 1 && dt[dtbh][wj.h - 1][wj.l] == 0)
	{
		wj.h--;
	} 
	if (axj('S') && wj.h + 1 < 40 && dt[dtbh][wj.h + 1][wj.l] == 0)
	{
		wj.h++;
	}
	return;
}

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值