#include<bits/stdc++.h>
#include<windows.h>
#define cls system("cls");
#define encls if(cin.get()=='\n') cls
#define slp(n) Sleep(n)
using namespace std;
const int rolesl=1;
struct role{
string name;
int blood_=10,blood=10,enegry_=1,enegry=1,gold=0;
}player,roles[rolesl];
void MainSpace(){
cout<<"+----+----+----+---<·>---+----+----+----+\n";
cout<<" State Event Cards\n";
cout<<"blood:"<<player.blood_<<"/"<<player.blood<<endl;//tack the event card
cout<<"enegry:"<<player.enegry_<<"/"<<player.enegry<<endl;//tack the event card
cout<<"gold:"<<player.gold<<endl;
cout<<endl;
cout<<" Brief Introduction \n";
}
void Start(){
roles[0].name="Witch";
cout<<"Hi adventurer!";
encls
cout<<"Well come to the 'Card Adventure'";
encls
choose:
cout<<"Choose one and click number:\n";
for(int i=0;i<rolesl;i++) cout<<"1."<<roles[i].name<<endl;
int k;char c;
cin>>k;
cls
player=roles[k-1];
cout<<"Are you sure you want to choose the “"<<player.name<<"”?\n";
cout<<"Yes(y) No(n)\n";
cin>>c;
if(c=='n') goto choose;
cls
cout<<"Are you ready?";
slp(1500);
for(int i=3;i>=1;i--){
cls
cout<<i;
slp(1000);
}
cls
MainSpace();
}
int main(){
Start();
return 0;
}
/*
+----+----+----+---<·>---+----+----+----+
State Event Cards
blood:-/- [name] [name] [name]
enegry:-/- (1) (2) (3)
gold:-
Brief Introduction
*/
大家英文不错的都应该能从函数名和变量名称获得信息
而一些类似cls、encls 的都用第2-5行的定义
choose:
这一行就是用来标记选择角色这一段代码
当我们回应为选好的时候
执行判断里面的goto
返回到刚刚标记的内容
cout<<"Are you sure you want to choose the “"<<player.name<<"”?\n";
cout<<"Yes(y) No(n)\n";
cin>>c;
if(c=='n') goto choose;
选好之后再倒数3个数之后进入到主界面
cout<<"Are you ready?";
slp(1500);
for(int i=3;i>=1;i--){
cls
cout<<i;
slp(1000);
}
cls
MainSpace();
说在最后:
其他的角色会在后期完善更新