跳到正文

个人记录

小游戏-在一切开始之前

Composite_Function约 47 分钟
原文
文章信息与版本

文章信息

发布
2023年5月4日
收录
2025年12月12日
更新
2026年11月22日
篇幅
约 47 分钟
获赞
3

版本

  1. v1当前

小游戏-在一切开始之前

这个游戏真的写了我很久 点个赞吧

预计八月出 2.0 版本

C++
#include <bits/stdc++.h>
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <fstream> 
using namespace std; 
// num
#define energy_impure_small 1
#define energy_impure_mid 2
#define energy_impure_big 3
#define energy_pure_small 4
#define energy_pure_mid 5
#define energy_pure_big 6
#define energy_worktop 7
#define purifying 8
#define collector 9
#define star 10
#define nebula 11
#define blackhole 12
#define partical_worktop 13
#define gravity_worktop 14
#define particle 15
#define normal_collector 16
// pos
#define collection 0
#define craft 10
#define craft_power 12
#define craft_partical 13
#define craft_gravity 14
#define backpack 21
#define honor 31
//other
#define up GetAsyncKeyState(VK_UP) & 0x8000
#define down GetAsyncKeyState(VK_DOWN) & 0x8000
#define left GetAsyncKeyState(VK_LEFT) & 0x8000
#define right GetAsyncKeyState(VK_RIGHT) & 0x8000
namespace Game
{
	int pos;
	char signal[10] = {'!', '@', '#', '$', '%', '^', '&', '*', '(', ')'}, ch;
	bool key(int num)
	{
		return GetAsyncKeyState(num) & 0x8000;
	}
	int Rand(int n)
	{
		srand(time(0));
		return rand() % n + 1;
	} 
	void SetPos(int x, int y)
	{
		--x, --y;
		COORD pos;
		pos.X = y*2,pos.Y = x; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
	}
	void color(int Forg, int Back)
	{
		WORD wColor = ((Back & 0x0F) << 4) + (Forg & 0x0f);
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
	}
	bool check()
	{
		ifstream x("text.txt");
		if (!x) return true;
		else return false;
	}
	string number(int _num)
	{
		char d;
		double _x;
		string _ret = "";
		if (_num >= 1e9) _x = _num / 1e9, d = 'b';
		else if (_num >= 1e6) _x = _num / 1e6, d = 'm';
		else if (_num >= 1e3) _x = _num / 1e3, d = 'k';
		else {
			char _A = _num / 100 + '0';
			char _B = _num / 10 % 10 + '0';
			char _C = _num % 10 + '0';
			_ret = "";
			if (_A != '0') _ret += _A;
			if (_B != '0' || _ret != "") _ret += _B;
			if (_C != '0' || _ret != "") _ret += _C;
			if (_ret == "") return "0";
			else return _ret;
		}
		int _y = floor(_x);
		if (_y / 100 != 0) _ret += _y / 100 + '0';
		if ((_y / 10 % 10 != 0) || (_ret != "")) _ret += _y / 10 % 10 + '0';
		if ((_y % 10 != 0 || (_ret != ""))) _ret += _y % 10 + '0';
		_ret += '.';
		_ret += floor((_x - floor(_x)) * 10) + '0';
		_ret += d;
		return _ret;
	}
	struct User_text
	{
		double gametime; // 单位 : 秒(second) 
		int is_finished[100], num[100];
		void error()
		{
			system("cls");
			cout << "程序错误,请联系FGX(洛谷fengguangxi,B站_FGX_)" << endl;
			cout << "试试以下可能 : ";
			cout << "- 输入错误";
			cout << "- 乱改代码";
			exit(0);
		}
		void clear()
		{
			for (int i = 0; i <= 99; ++i) is_finished[i] = 0, num[i] = 0;
		}
		int decrypt(string s) 
		{
			if (s == "_") return 0;
			int num = 0;
			for (int i = s.length() - 1; i >= 0; --i) {
				int tmp = 0;
				for (int j = 0; j < 10; ++j) if (signal[j] == s[i]) tmp = j;
				num = num * 10 + tmp;
			}
			return num;
		}
		string encrypt(int num)
		{
			string s;
			while (num > 0) s += signal[num % 10], num /= 10;
			return s;
		}
		void read()
		{
			system("cls");
			SetPos(1, 1), cout << "请输入读取码:";
			string text;
			cin >> text;
			int count_input = 0;
			for (int pos = 0; pos < text.length(); ++count_input) {
				string input_text = "";
				while (text[pos++] != '_') input_text += text[pos - 1];
				if (count_input == 0) {
					gametime = decrypt(input_text) / 10.0;
					continue;
				}
				int* element_position = NULL;
				if (count_input > 99) element_position = is_finished + count_input - 99;
				else element_position = num + count_input;
				*element_position = decrypt(input_text);
				if (count_input > 198) error();
			}
			if (count_input < 198) error();
			system("pause");
		}
		void save()
		{
			cout << encrypt(gametime * 10) << "_";
			for (int i = 1; i <= 99; ++i) cout << encrypt(num[i]) << "_";
			for (int i = 1; i <= 99; ++i) cout << encrypt(is_finished[i]) << "_";
		}
		void do_honor(int id)
		{
			if (is_finished[id] == 1) return;
			is_finished[id] = 1;
			if (id == 1) SetPos(15, 25), color(15, 0), cout << "  宇宙的起源!";
			if (id == 2) SetPos(15, 25), color(15, 0), cout << "        融合!";
			if (id == 3) SetPos(15, 25), color(2 ,0), cout << "      计时器!";
			if (id == 4) SetPos(15, 25), color(2, 0), cout << "    星际计划!";
			if (id == 5) SetPos(15, 25), color(2, 0), cout << "      破百万!";
			if (id == 6) SetPos(15, 25), color(1, 0), cout << "    结局了吗!";
		}
		void give(int _type, int _num)
		{
			if (_num == 0) return; 
			num[_type] += _num;
			do_honor(2);
			if (_type == star) do_honor(4);
			if (_type == blackhole) do_honor(6);
		}
	}user;
}
using namespace Game;
int main()
{
	color(3, 0); system("mode con cols=80 lines=20");
	CONSOLE_CURSOR_INFO cursor_info = {1, 0};
	SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
	SetPos(1, 1), cout << "    欢迎来到 FGX 的小游戏『在一切开始之前』,我是 FGX,如果喜欢希望推广一下,其实这游戏还有很大的潜力,蒟蒻作者以后还会努力更新的!";
	SetPos(3, 1), cout << "    如果希望看到更多游戏,按下 '<' 键以返回 FGX 的个人主页"; 
	color(15, 0), SetPos(4, 1), cout << "  ----------------------------------------------------------------------------  ", color(3, 0);
	SetPos(9, 18), cout << "- 1.读取";
	SetPos(11, 18), cout << "- 2.新建";
	color(15, 0), SetPos(7, 10), cout << "在", SetPos(9, 10), cout << "一", SetPos(11, 10), cout << "切", SetPos(13, 10), cout << "开";
	SetPos(8, 30), cout << "始", SetPos(10, 30), cout << "之", SetPos(12, 30), cout << "前", SetPos(1, 0), color(3, 0);
	color(15, 0), SetPos(17, 1), cout << "  ----------------------------------------------------------------------------  ", color(3, 0);
	SetPos(18, 1), cout << "    写在最后:本游戏微肝,请游玩的人做好心理准备,建议准备 10 个迪哥(笑;如果实在不行,按下 ';' 来调整参数";
	while (1) {
		ch = getch();
		if (ch == '<') system("start https://www.luogu.com.cn/user/531746");
		if (ch == '1' || ch == '2') break;
	}
	SetPos(15, 17), cout << "Loading. . . " << endl; 
	if (ch == '1') user.read();
	else if (ch == '2') {
		user.clear();
		user.do_honor(1);
	}
	system("cls");
	pos = -1;
	while (1) {
		system("cls"), SetPos(1, 20), color(11, 0), cout << "游戏时长 : " << user.gametime, user.gametime = round(user.gametime * 5) / 5.0;
		color(3, 0), SetPos(5, 2), cout << "在", SetPos(7, 2), cout << "一", SetPos(9, 2), cout << "切", SetPos(11, 2), cout << "开", SetPos(13, 2), cout << "始", SetPos(15, 2), cout << "之", SetPos(17, 2), cout << "前";
		for (int i = 1; i <= 20; ++i) SetPos(i, 4), cout << "|";
		for (int i = 1; i <= 20; ++i) SetPos(i, 8), cout << " |";
		SetPos(5, 4), cout << "|________|", SetPos(10, 4), cout << "|________|", SetPos(15, 4), cout << "|________|";
		if (pos == craft || pos == craft_power || pos == craft_partical || pos == craft_gravity) {
			for (int i = 1; i <= 20; ++i) SetPos(i, 15), color(3, 0), cout << " |";
			SetPos(7, 8), cout << " |_____________|", SetPos(13, 8), cout << " |_____________|";
			if (pos == craft_power) SetPos(4, 9), color(3, 0), cout << " ", color(0, 3), cout << "能量合成台", color(3, 0);
			else SetPos(4, 9), color(3, 0), cout <<  " 能量合成台";
			if (pos == craft_partical) SetPos(10, 9), color(3, 0), cout << " ", color(0, 3), cout << "粒子合成台", color(3, 0);
			else SetPos(10, 9), color(3, 0), cout << " 粒子合成台";
			if (pos == craft_gravity) SetPos(17, 9), color(3, 0), cout << " ", color(0, 3), cout << "引力合成台", color(3, 0);
			else SetPos(17, 9), color(3, 0), cout << " 引力合成台";
		} 
		if (pos == collection) SetPos(3, 5), color(3, 0), cout << " ", color(0, 3), cout << "收集", color(3, 0); 
		else SetPos(3, 5), color(3, 0), cout << " ", cout << "收集"; 
		if (pos == craft) SetPos(8, 5), color(3, 0), cout << " ", color(0, 3), cout << "合成", color(3, 0);
		else SetPos(8, 5), color(3, 0), cout << " 合成";
		if (pos == backpack) SetPos(13, 5), color(3, 0), cout << " ", color(0, 3), cout << "库存", color(3, 0);
		else SetPos(13, 5), color(3, 0), cout << " 库存";
		if (pos == honor) SetPos(18, 5), color(3, 0), cout << " ", color(0, 3), cout << "成就", color(3, 0);
		else SetPos(18, 5), color(3, 0), cout << " 成就";
		if (pos == collection) {
			SetPos(3, 10), color(15, 0), cout << "空格 - 收集『粒子 - 小』* " << 1 + user.num[collector] << " ~ " << 4 + user.num[collector];
			SetPos(5, 10), color(15, 0), cout << "1 秒 - 收集『粒子 - 小』* " << floor(user.num[collector] * (1 + user.num[star] / 10.0));
			SetPos(7, 10), color(15, 0), cout << "10秒 - 收集『粒子 - 小』* " << user.num[normal_collector];
			SetPos(9, 10), color(15, 0), cout << "1 秒 - 收集『", color(2, 0), cout << "纯能粒子 - 小", color(15, 0), cout << "』* " << floor(user.num[nebula]);
			SetPos(11, 10), color(15, 0), cout << "10秒 - 收集『", color(1, 0), cout << "基本粒子", color(15, 0), cout << "』* " << ceil(user.num[blackhole] * 10);
			if (key(32)) user.give(energy_impure_small, Rand(4) + user.num[collector]), SetPos(3, 9), cout << "->";
			if ((floor(user.gametime) == ceil(user.gametime)) && (floor(user.num[collector] * (1 + user.num[star] / 10.0)) != 0)) SetPos(5, 9), cout << "->";
			if ((floor(user.gametime / 10) == ceil(user.gametime / 10)) && (user.num[normal_collector] != 0)) SetPos(7, 9), cout << "->";
			if ((floor(user.gametime) == ceil(user.gametime)) && floor(user.num[nebula]) != 0) SetPos(9, 9), cout << "->";
			if ((floor(user.gametime / 10) == ceil(user.gametime / 10)) && ceil(user.num[blackhole] * 10) != 0) SetPos(11, 9), cout << "->";
		}
		else if (pos == craft) { // 0 - 48 1 - 49
			SetPos(3, 20), color(15, 0), cout << "1. 粒子 - 中(所需 : 粒子 - 小 * 10)";
			SetPos(4, 20), color(15, 0), cout << "2. 粒子 - 大(所需 : 粒子 - 中 * 10)";
			SetPos(5, 20), color(15, 0), cout << "3. 能量合成台(所需 : 粒子 - 大 * 10)"; 
			if (key(49)) {
				if ((key(16) || key(160))) {
					int count = user.num[energy_impure_small] / 10;
					user.num[energy_impure_small] -= count * 10;
					user.give(energy_impure_mid, count);
					SetPos(15, 25), cout << "合成成功";
				} 
				else if (user.num[energy_impure_small] >= 10) {
					user.num[energy_impure_small] -= 10;
					user.give(energy_impure_mid, 1);
					SetPos(15, 25), cout << "合成成功"; 
				}
				else SetPos(15, 25), cout << "资源不足";
			}
			if (key(50)) {
				if ((key(16) || key(160))) {
					int count = user.num[energy_impure_mid] / 10;
					user.num[energy_impure_mid] -= count * 10;
					user.give(energy_impure_big, count);
					SetPos(15, 25), cout << "合成成功";
				} 
				else if (user.num[energy_impure_mid] >= 10) {
					user.num[energy_impure_mid] -= 10;
					user.give(energy_impure_big, 1);
					SetPos(15, 25), cout << "合成成功"; 
				}
				else SetPos(15, 20), cout << "资源不足";
			}
			if (key(51)) {
				if ((key(16) || key(160))) {
					int count = user.num[energy_impure_big] / 10;
					user.num[energy_impure_big] -= count * 10;
					user.give(energy_worktop, count);
					SetPos(15, 25), cout << "合成成功";
				} 
				else if (user.num[energy_impure_big] >= 10) {
					user.num[energy_impure_big] -= 10;
					user.give(energy_worktop, 1);
					SetPos(15, 25), cout << "合成成功"; 
				}
				else SetPos(15, 20), cout << "资源不足";
			}
		}
		else if (pos == craft_power) {
			SetPos(2, 20), color(15, 0), cout << "以下均消耗一个能量合成台";
			SetPos(3, 20), color(15, 0), cout << "1. 简单收集器(所需 : 粒子 - 大 * 10)";
			SetPos(4, 20), color(15, 0), cout << "2. 纯能粒子 - 小 * 100", SetPos(5, 20), cout << "(所需 : 粒子 - 小 * 100 + 纯能转化器 * 1)";
			SetPos(6, 20), color(15, 0), cout << "3. 纯能粒子 - 中 * 100", SetPos(7, 20), cout << "(所需 : 纯能粒子 - 小 * 1000)";
			SetPos(8, 20), color(15, 0), cout << "4. 纯能粒子 - 大 * 100", SetPos(9, 20), cout << "(所需 : 纯能粒子 - 中 * 1000)";
			SetPos(10, 20), color(15, 0), cout << "5. 基本粒子 * 10", SetPos(11, 20), cout << "(所需 : 纯能粒子 - 大 * 10)";
			SetPos(12, 20), color(15, 0), cout << "6. 粒子合成台 * 1", SetPos(13, 20), cout << "(所需 : 基本粒子 * 10)";
			SetPos(14, 20), color(15, 0), cout << "7. 纯能转化器 * 1", SetPos(15, 20), cout << "(所需 : 粒子 - 小 * 10)";
			if (key(49)) {
				if ((key(16) || key(160))) {
					int count = min(user.num[energy_impure_big] / 10, user.num[energy_worktop]);
					user.num[energy_impure_big] -= count * 10;
					user.num[energy_worktop] -= count;
					user.give(normal_collector, count);
					SetPos(16, 25), cout << "合成成功";
				} 
				else if (user.num[energy_impure_big] >= 10 && user.num[energy_worktop] >= 1) {
					user.num[energy_impure_big] -= 10;
					user.num[energy_worktop] -= 1;
					user.give(normal_collector, 1);
					SetPos(16, 25), cout << "合成成功"; 
				}
				else SetPos(16, 25), cout << "资源不足";
			}
			if (key(50)) {
				if ((key(16) || key(160))) {
					int count = min(min(user.num[energy_impure_small] / 100, user.num[purifying]), user.num[energy_worktop]);
					user.num[energy_impure_big] -= count * 100;
					user.num[purifying] -= count;
					user.num[energy_worktop] -= count;
					user.give(energy_pure_mid, count * 100);
					SetPos(16, 25), cout << "合成成功";
				} 
				else if (user.num[energy_impure_small] >= 100 && user.num[purifying] >= 1 && user.num[energy_worktop] >= 1) {
					user.num[energy_impure_small] -= 100;
					user.num[purifying] -= 1;
					user.num[energy_worktop] -= 1;
					user.give(energy_pure_mid, 100);
					SetPos(16, 25), cout << "合成成功"; 
				}
				else SetPos(16, 25), cout << "资源不足";
			}
			if (key(51)) {
				if ((key(16) || key(160))) {
					int count = min(user.num[energy_pure_small] / 1000, user.num[energy_worktop]);
					user.num[energy_pure_small] -= count * 1000;
					user.num[energy_worktop] -= count;
					user.give(energy_pure_mid, count * 100);
					SetPos(16, 25), cout << "合成成功";
				} 
				else if (user.num[energy_pure_small] >= 1000 && user.num[energy_worktop] >= 1) {
					user.num[energy_pure_small] -= 1000;
					user.num[energy_worktop] -= 1;
					user.num[energy_pure_mid] += 100;
					user.give(energy_pure_mid, 100);
					SetPos(16, 25), cout << "合成成功"; 
				}
				else SetPos(16, 25), cout << "资源不足";
			}
			if (key(52)) {
				if ((key(16) || key(160))) {
					int count = min(user.num[energy_pure_mid] / 1000, user.num[energy_worktop]);
					user.num[energy_pure_mid] -= count * 1000;
					user.num[energy_worktop] -= count;
					user.give(energy_pure_big, count * 100);
					SetPos(16, 25), cout << "合成成功";
				} 
				else if (user.num[energy_pure_mid] >= 1000 && user.num[energy_worktop] >= 1) {
					user.num[energy_pure_mid] -= 1000;
					user.num[energy_worktop] -= 1;
					user.give(energy_pure_big, 100);
					SetPos(16, 25), cout << "合成成功"; 
				}
				else SetPos(16, 20), cout << "资源不足";
			}
			if (key(53)) {
				if ((key(16) || key(160))) {
					int count = min(user.num[energy_pure_big] / 10, user.num[energy_worktop]);
					user.num[energy_pure_big] -= count * 10;
					user.num[energy_worktop] -= count;
					user.give(purifying, count);
					SetPos(16, 25), cout << "合成成功";
				} 
				else if (user.num[energy_pure_big] >= 10 && user.num[energy_worktop] >= 1) {
					user.num[energy_pure_big] -= 10;
					user.num[energy_worktop] -= 1;
					user.give(purifying, 1);
					SetPos(16, 25), cout << "合成成功"; 
				}
				else SetPos(16, 25), cout << "资源不足";
			}
			if (key(54)) {
				if ((key(16) || key(160))) {
					int count = min(user.num[particle] / 10, user.num[energy_worktop]);
					user.num[particle] -= count * 10;
					user.num[energy_worktop] -= count;
					user.give(partical_worktop, count);
					SetPos(16, 25), cout << "合成成功";
				} 
				else if (user.num[particle] >= 10 && user.num[energy_worktop] >= 1) {
					user.num[particle] -= 10;
					user.num[energy_worktop] -= 1;
					user.give(partical_worktop, 1);
					SetPos(16, 25), cout << "合成成功";  
				}
				else SetPos(16, 25), cout << "资源不足";
			}
			if (key(55)) {
				if ((key(16) || key(160))) {
					int count = min(user.num[energy_impure_big] / 10, user.num[energy_worktop]);
					user.num[energy_impure_big] -= count * 10;
					user.num[energy_worktop] -= count;
					user.give(energy_worktop, count);
					SetPos(16, 25), cout << "合成成功";
				} 
				else if (user.num[energy_impure_big] >= 10 && user.num[energy_worktop] >= 1) {
					user.num[energy_impure_big] -= 10;
					user.num[energy_worktop] -= 1;
					user.give(energy_worktop, 1);
					SetPos(16, 25), cout << "合成成功"; 
				}
				else SetPos(16, 25), cout << "资源不足";
			}
		}
		else if (pos == craft_partical) {
			SetPos(2, 20), color(15, 0), cout << "一下均消耗一个粒子合成台"; 
			SetPos(3, 20), color(15, 0), cout << "1. 收集器 * 1(所需 : 基本粒子 * 100)";
			SetPos(4, 20), color(15, 0), cout << "2. 恒星 * 1(所需 : 基本粒子 * 10000)";
			SetPos(5, 20), color(15, 0), cout << "3. 引力合成台 * 10(所需 : 恒星 * 1)";
			if (key(49)) {
				if ((key(16) || key(160))) {
					int count = min(user.num[particle] / 100, user.num[partical_worktop]);
					user.num[particle] -= count * 100;
					user.num[partical_worktop] -= count;
					user.give(collector, count);
					SetPos(15, 25), cout << "合成成功";
				} 
				else if (user.num[particle] >= 100 && user.num[partical_worktop] >= 1) {
					user.num[particle] -= 100;
					user.num[partical_worktop] -= 1;
					user.give(collector, 1);
					SetPos(15, 25), cout << "合成成功"; 
				}
				else SetPos(15, 25), cout << "资源不足";
			}
			if (key(50)) {
				if ((key(16) || key(160))) {
					int count = min(user.num[particle] / 10000, user.num[partical_worktop]);
					user.num[particle] -= count * 10000;
					user.num[partical_worktop] -= count;
					user.give(star, count);
					SetPos(15, 25), cout << "合成成功";
				} 
				else if (user.num[particle] >= 10000 && user.num[partical_worktop] >= 1) {
					user.num[particle] -= 10;
					user.num[partical_worktop] -= 1;
					user.give(star, 1);
					SetPos(15, 25), cout << "合成成功"; 
				}
				else SetPos(15, 25), cout << "资源不足";
			}
			if (key(51)) {
				if ((key(16) || key(160))) {
					int count = min(user.num[star], user.num[partical_worktop]);
					user.num[star] -= count;
					user.num[energy_worktop] -= count;
					user.give(gravity_worktop, count * 10);
					SetPos(15, 25), cout << "合成成功";
				} 
				else if (user.num[star] >= 1 && user.num[partical_worktop] >= 1) {
					user.num[star] -= 10;
					user.num[partical_worktop] -= 1;
					user.give(gravity_worktop, 10);
					SetPos(15, 25), cout << "合成成功"; 
				}
				else SetPos(15, 25), cout << "资源不足";
			}
		}
		else if (pos == craft_gravity) {
			SetPos(2, 20), color(15, 0), cout << "一下均消耗一个引力合成台"; 
			SetPos(3, 20), color(15, 0), cout << "1. 星云 * 1(所需 : 恒星 * 100)";
			SetPos(4, 20), color(15, 0), cout << "2. 黑洞 * 1(所需 : 恒星 * 100)(仅有1%成功)";
			if (key(49)) {
				if ((key(16) || key(160))) {
					int count = min(user.num[star] / 100, user.num[gravity_worktop]);
					user.num[star] -= count * 100;
					user.num[gravity_worktop] -= count;
					user.give(nebula, count);
					SetPos(15, 25), cout << "合成成功";
				} 
				else if (user.num[star] >= 100 && user.num[gravity_worktop] >= 1) {
					user.num[particle] -= 100;
					user.num[gravity_worktop] -= 1;
					user.give(nebula, 1);
					SetPos(15, 25), cout << "合成成功"; 
				}
				else SetPos(15, 25), cout << "资源不足";
			}
			if (key(50)) {
				if ((key(16) || key(160))) {
					int count = min(user.num[particle] / 100, user.num[gravity_worktop]), _count = 0;
					user.num[particle] -= count * 100;
					user.num[partical_worktop] -= count;
					while (count--) if (Rand(100) == 1) ++_count;
					user.give(blackhole, _count);
					SetPos(15, 25), cout << "合成成功";
				} 
				else if (user.num[particle] >= 100 && user.num[gravity_worktop] >= 1) {
					user.num[particle] -= 100;
					user.num[gravity_worktop] -= 1;
					if (Rand(100) == 1) user.give(blackhole, 1);
					SetPos(15, 25), cout << "合成成功"; 
				}
				else SetPos(15, 25), cout << "资源不足";
			}
		}
		else if (pos == backpack) {
			SetPos(2, 10), color(15, 0), cout << "粒子 - 小", color(15, 0), cout << " * " << number(user.num[energy_impure_small]);
			SetPos(3, 10), color(15, 0), cout << "粒子 - 中", color(15, 0), cout << " * " << number(user.num[energy_impure_mid]);
			SetPos(4, 10), color(15, 0), cout << "粒子 - 大", color(15, 0), cout << " * " << number(user.num[energy_impure_big]);
			SetPos(5, 10), color(2, 0), cout << "能量合成台", color(15, 0), cout << " * " << number(user.num[energy_worktop]);
			SetPos(6, 10), color(2, 0), cout << "简单收集器", color(15, 0), cout << " * " << number(user.num[normal_collector]);
			SetPos(7, 10), color(2, 0), cout << "纯能粒子 - 小", color(15, 0), cout << " * " << number(user.num[energy_pure_small]);
			SetPos(8, 10), color(2, 0), cout << "纯能粒子 - 中", color(15, 0), cout << " * " << number(user.num[energy_pure_mid]);
			SetPos(9, 10), color(2, 0), cout << "纯能粒子 - 大", color(15, 0), cout << " * " << number(user.num[energy_pure_big]);
			SetPos(10, 10), color(2, 0), cout << "纯能转化器", color(15, 0), cout << " * " << number(user.num[purifying]);
			SetPos(11, 10), color(1, 0), cout << "基本粒子", color(15, 0), cout << " * " << number(user.num[particle]);
			SetPos(12, 10), color(1, 0), cout << "粒子合成台", color(15, 0), cout << " * " << number(user.num[partical_worktop]);
			SetPos(13, 10), color(1, 0), cout << "收集器", color(15, 0), cout << " * " << number(user.num[collector]); 
			SetPos(14, 10), color(1, 0), cout << "恒星", color(15, 0), cout << " * " << number(user.num[star]);
			SetPos(15, 10), color(5, 0), cout << "引力合成台", color(15, 0), cout << " * " << number(user.num[gravity_worktop]);
			SetPos(16, 10), color(5, 0), cout << "星系", color(15, 0), cout << " * " << number(user.num[nebula]); 
			SetPos(17, 10), color(4, 0), cout << "黑洞", color(15, 0), cout << " * " << number(user.num[blackhole]);
		}
		else if (pos == honor) {
			if (user.is_finished[1] == 1) SetPos(3, 10), color(15, 0), cout << "1. 宇宙的起源!";
			if (user.is_finished[2] == 1) SetPos(4, 10), color(15, 0), cout << "2. 融合!", SetPos(5, 10), color(15, 0), cout << "提示 : SHIFT 集体合成";
			if (user.is_finished[3] == 1) SetPos(6, 10), color(2 ,0), cout << "3. 计时器!";
			if (user.is_finished[4] == 1) SetPos(7, 10), color(2, 0), cout << "4. 星际计划!";
			if (user.is_finished[5] == 1) SetPos(8, 10), color(2, 0), cout << "5. 破百万!";
			if (user.is_finished[6] == 1) SetPos(9, 10), color(1, 0), cout << "6. 结局了吗!", SetPos(10, 10), color(15, 0), cout << "提示 : 作者会努力更新的!";
		}
		else if (pos == -1) {
			SetPos(10, 10), cout << "按 Backspace 查看读取码";
		}
		if (right) {
			if (pos == -1) pos = collection;
			else if (pos == craft) pos = craft_partical;
		}
		if (left) {
			if (pos == collection || pos == collection || pos == backpack || pos == honor) pos == -1;
			else if (pos == craft_power) pos = craft;
			else if (pos == craft_partical) pos = craft;
			else if (pos == craft_gravity) pos = craft; 
		}
		if (up) {
			if (pos == craft) pos = collection;
			else if (pos == backpack) pos = craft;
			else if (pos == honor) pos = backpack;
			else if (pos == craft_partical) pos = craft_power;
			else if (pos == craft_gravity) pos = craft_partical; 
		}
		if (down) {
			if (pos == collection) pos = craft;
			else if (pos == craft) pos = backpack;
			else if (pos == backpack) pos = honor;
			else if (pos == craft_power) pos = craft_partical;
			else if (pos == craft_partical) pos = craft_gravity;
		}
		if (floor(user.gametime) == ceil(user.gametime)) user.give(energy_impure_small, floor(user.num[collector] * (1 + user.num[star] / 10.0)));
		if (floor(user.gametime / 10) == ceil(user.gametime / 10)) user.give(energy_impure_small, user.num[normal_collector]); 
		if (floor(user.gametime) == ceil(user.gametime)) user.give(energy_pure_small, floor(user.num[star] * (1.0 + user.num[nebula] * 1.0)));
		if (floor(user.gametime / 10) == ceil(user.gametime / 10)) user.give(particle, ceil(user.num[blackhole] / 10.0));
		if (key(8)) {
			system("cls");
			SetPos(1, 1), color(15, 0), cout << "读取码为:" << endl, user.save(), cout << endl;
			system("pause");
		}
		Sleep(200), user.gametime += 0.2;
		if (user.gametime == 1000) user.do_honor(3);
		if (user.num[energy_impure_small] >= 1000000) user.do_honor(5);
	}
	return 0;
}
原文
存档评论2 条抓取于