自制版-原神文字版v0.2
2025-08-21 22:01:34
发布于:上海
废话不多说直接上代码:
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
int lead,x = 0,y = 0,z = 0;
string name;
bool press(char vKey){
return (GetAsyncKeyState(vKey) & 0x8000);
}void operation(){
system("cls");
cout << "当前位置:" << x << "," << y << "," << z << " 请输入你的操作:" << endl;
cout << "-----------------------------------------------------------" << endl;
cout << "w:向前移动5m,a:向左移动5m,s:向后移动5m,d:向右移动5m,空格:跳跃" << endl;
cout << "-----------------------------------------------------------" << endl;
while (1){
if (press('W')){
z += 5;
}if (press('A')){
x -= 5;
}if (press('S')){
z -= 5;
}if (press('D')){
x += 5;
}if (press('N') && press('B')){
cout << "当前位置:" << x << "," << y << "," << z << " 请输入你的操作:" << endl;
cout << "-----------------------------------------------------------" << endl;
cout << "w:向前移动5m,a:向左移动5m,s:向后移动5m,d:向右移动5m,x:跳跃" << endl;
cout << "-----------------------------------------------------------" << endl;
}if (press(' ')){
y += 5;
}Sleep(100);
}
}void prepare2(){
system("cls");
Sleep(1000);
if (lead == 1){
cout << "就这样,陌生的神明带走了我的妹妹,我也被神封印,失去了原本的力量,曾经跨越诸多世界的我们,受困于此" << endl;
cout << "空:那究竟是多少年前的事呢,我不知道,但我会想办法查清楚的,醒来之后我总是一个人流浪,直到两个月前,遇到了你" << endl;
cout << "派蒙:嗯嗯,那时多亏了你,否则我大概已经淹死了,所以,我会努力做一个好向导的" << endl;
}else if (lead == 2){
cout << "就这样,陌生的神明带走了我的哥哥,我也被神封印,失去了原本的力量,曾经跨越诸多世界的我们,受困于此" << endl;
cout << "荧:那究竟是多少年前的事呢,我不知道,但我会想办法查清楚的,醒来之后我总是一个人流浪,直到两个月前,遇到了你" << endl;
cout << "派蒙:嗯嗯,那时多亏了你,否则我大概已经淹死了,所以,我会努力做一个好向导的" << endl;
}Sleep(3000);
cout << "派蒙:该出发了,我们走吧";
Sleep(1000);
operation();
}void prepare1(){
cout << " ____________" << endl;
cout << "| mihoyo |" << endl;
cout << "| 原神 |" << endl;
Sleep(2000);
system("cls");
cout << " ____ " << endl;
cout << " / \\ " << endl;
cout << " ___/ \\___ " << endl;
cout << " / \\ " << endl;
cout << " | __________ | " << endl;
cout << " / / \\ \\ " << endl;
cout << " | | | | " << endl;
cout << " | | | | " << endl;
cout << " | | | | " << endl;
cout << " | | | | " << endl;
cout << " | | 输入任意 | | " << endl;
cout << " | | 内容进入 | | " << endl;
cout << " | | | | " << endl;
cout << "____|__|__________|__|____" << endl;
string joingame;
cin >> joingame;
system("cls");
cout << "|火|水|风|雷|草|冰|岩|" << endl;
cout << "正在加载中...";
Sleep(2000);
system("cls");
cout << "所以说," << endl;
Sleep(2000);
cout << "你们是从世界之外," << endl;
Sleep(2000);
cout << "漂流来的?" << endl;
Sleep(2000);
system("cls");
cout << "但就在你们想离开这里,前往下一个世界的时候," << endl;
Sleep(2000);
cout << "却有陌生的神明,拦在你们的面前," << endl;
Sleep(2000);
cout << "天理维系者:外来之人,你们的旅途到此为止!" << endl;
Sleep(2000);
cout << "旅行者:什么人!?" << endl;
Sleep(2000);
cout << "天理维系者:天理的维系者,以此来终结人之子的锲约" << endl;
Sleep(2000);
cout << "(旅行者飞到了空中,拿起了剑,准备干掉天理维系者)" << endl;
Sleep(2000);
cout << "在双子中选择1人(输入1或2:1.空 2.荧)" << endl;
cin >> lead;
if (lead != 1 && lead != 2){
cout << "输入错误,请重新开始游戏";
Sleep(3000);
return;
}else{
cout << "写下你的名字:";
cin >> name;
}if (lead == 1){
cout << "(天理维系者带走了荧)" << endl;
Sleep(2000);
cout << "空:荧!" << endl;
Sleep(2000);
cout << "(空打出了他以为的致命一击)" << endl;
Sleep(2000);
cout << "(数秒后,天理维系者封印了空原本的力量)" << endl;
}else{
cout << "(天理维系者带走了空)" << endl;
Sleep(2000);
cout << "荧:空!" << endl;
Sleep(2000);
cout << "(荧打出了她以为的致命一击)" << endl;
Sleep(2000);
cout << "(数秒后,天理维系者封印了荧原本的力量)" << endl;
}Sleep(2000);
prepare2();
}int main(){
SetConsoleTitle ("原神-文字版");
cout << "原神(文字版)\n";
cout << "按下Enter(回车)开始游戏\n";
while (!press(VK_RETURN)){
if (press(VK_RETURN)){
break;
}Sleep(100);
}prepare1();
return 0;
}
这里空空如也
有帮助,赞一个