跳到正文

个人记录

超级跑酷(未完成)

Coder_MartinQiu约 7 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年3月11日
篇幅
约 7 分钟

版本

  1. v1当前

警告:$这个符号可能消失!!!

C++
#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
using namespace std;

struct PLAYER{
	string name;
	int x=5,y=15,fight_strong=10,healthy=100,scores=0,many=0;
	int weapon_top=0;
	struct weapon{
		string name;
		int Enhanced_fight;
	}wp[100];
}player;

string mp[10]={"  \\|/           /``````\\                        ",
			   " --O--         (________>>>>       /``````\\      ",
			   "  /|\\                            (________>>>>   ",
			   "                                                  ",
			   "                                                  ",
			   "                                                  ",
			   "==================================================",
			   "                                                  ",
			   "                                                  ",
			   "                                                  ",};

int get_rand(int l,int r){
	return rand()%r+l;
}

int foe_num=3;

struct FOE{
	int x,y,fight_strong=10,healthy=50;
	bool flag=0;
}foe[5];

void welcome(){
	cout<<"       § 超级跑酷 §\n press any key to continue...\n\n\n"<<endl;
	srand(time(0));
	cout<<" made by @player_qiumingxuan"<<endl;
	char Cc;
	Cc=getch();
	system("cls");
	return;
}

void Beginner_Tutorial(){
	cout<<" = 表示道路\n";
	Sleep(500);
	cout<<" & 表示自己所在的位置\n";
	Sleep(500);
	cout<<" n 表示石头\n";
	Sleep(500);
	cout<<" $ 表示金币\n";
	Sleep(500);
	cout<<" @ 表示商城\n";
	Sleep(500);
	cout<<" q 表示怪物\n";
	Sleep(500);
	cout<<"按 a 键向左走\n";
	Sleep(500);
	cout<<"按 d 键向右走\n";
	Sleep(500);
	cout<<"按 s 键向下钻\n";
	Sleep(500);
	cout<<"按 w 键向上跳\n";
	Sleep(500);
	cout<<"按 wa 键向左上跳\n";
	Sleep(500);
	cout<<"按 wd 键向右上跳\n";
	Sleep(500);
	cout<<"按 as 键向左下钻\n";
	Sleep(500);
	cout<<"按 ds 键向右下钻\n";
	Sleep(500);
	cout<<"按 e 键拾取\n";
	Sleep(500);
	cout<<"按其他英文键不动\n";
	Sleep(500);
	cout<<"按任意键退出\n";
	char Cc;
	Cc=getch();
	system("cls");
	return;
}

void init(){
	cout<<"请输入名称:\n";
	cin>>player.name;
	Sleep(500);
	system("cls");
	cout<<"是否进入新手教程?\n1.是; 0.否\n";
	bool TF;
	cin>>TF;
	if(TF)	Beginner_Tutorial();
	Sleep(800);
	system("cls");
	return;
}

void state(){
	cout<<"名称:"<<player.name<<" ;\n";
	cout<<"积分:"<<player.scores<<" ;\n";
	cout<<"战斗力:"<<player.fight_strong<<" 生命值:"<<player.healthy<<" ;\n";
	cout<<"道具库:\n";
	if(!player.weapon_top) cout<<"无 ;\n";
	else{
		for(int i=1;i<=player.weapon_top;i++){
			cout<<i<<": "<<player.wp[i].name<<" 战斗加成:"<<player.wp[i].Enhanced_fight<<" ;\n";
		}
	}
	cout<<"\n";
	for(int i=0;i<10;i++){
		for(int j=0;j<mp[i].size();j++){
			if(i==player.x && j==player.y)	cout<<"&";
			else	cout<<mp[i][j];
		}
		cout<<"\n";
	}
	return;
}

void mall(){
	//make,please
	return;
}

void fight(){
	//make,please
	return;
}

void go(){

	return;
}

void Turn(char turn){
	int nx=player.x,ny=player.y;
	if(turn=='w'){
		if(nx==5)	nx--;
		else if(nx==4)	nx++;
	}
	if(turn=='s')	nx++;
	if(turn=='a'){
		if(nx==4)	nx++;
		ny--;
	}
	if(turn=='d'){
		if(nx==4)	nx++;
		ny++;
	}
	if(mp[nx][ny]=='n')	return;
	if(mp[nx][ny]=='=')	return;
	if(mp[nx][ny]=='@'){
		mall();
		return;
	}
	if(mp[nx][ny]=='$'){
		cout<<"是否按 e 键拾取金币?\n";
		char e;
		cin>>e;
		if(e=='e')	player.many+=10;
	}
	if(mp[nx][ny]=='q')	 fight();
	player.x=nx,player.y=ny;
	return;
}

int main(){
	welcome();
	init();
	while(true){
		if(player.healthy<=0){
			cout<<"游戏结束!!!\n";
			cout<<"你的积分为:"<<player.scores<<"\n";
			return 0;
		}
		go();
		state();
		char turn;
		cin>>turn;
		Turn(turn);
		system("cls");
	}
	return 0;
}
原文