八宝粥行动
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
namespace _game{
//常量
const long long ESC=27,
Enter=13,
Tab=9,
Shang=38,
Xia=40,
Zuo=37,
You=39,
Kong=' ',
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';
}
//system("cls");
//Sleep(150);
//GetKeyState('A')<0;
//地图
int dt,dtsl=1;//地图,地图数量
string dtmc[]={"未选择","零号大坝"};//地图名称
string dtmx[][16]={//地图模型
{
"################################",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"################################"
},
{//零号大坝总地图
"################################",
"# ########## JJJJ C#",
"#SSSSSS #XXX###### JJJ #",
"#SSSSSS JJ J #",
"#SSSSSS BBB#",
"#G --- BBB#",
"#GJJJJ ------- BBB#",
"#GJJJJ ----------- BBB#",
"#G ------- BBB#",
"# --- #",
"#~~~~~~~ #",
"#~~~~~~~ YYYYYY #",
"#~~~~~~~ YYYYYY #",
"# YYYYYY #",
"# #",
"################################",
},
{//行政楼
"################################",
"#[] **# #",
"# # #",
"#= # #",
"###$### #",
"#* *# #",
"#* =# #",
"# $ #",
"###### #",
"#* # #",
"#* # #",
"# $ #",
"###### ###### #",
"# #** # #",
"# # $ #",
"#XXX############################"
}
};
//干员
int gy,gysl=1;//干员,干员数量
string gymc[]={"未选择","威龙"};//干员名称
//武器
int zwq1,zwq2,sq,d,zwqsl,sqsl,dsl;//主武器1,主武器2,手枪,刀,主武器数量,手枪数量,刀数量
string zwqmc[]={"未选择"},sqmc[]={"未选择"},dmc[]={"未选择"};//主武器名称,手枪名称,刀名称
void out(string,int,bool);
void kaishiyouxi();
void chushimianban();
void xuanzeditu();
void zhanbeixuanze();
void kaishixingdong();
void linghaodaba();
void xingzhenglou();
void kaishiyouxi(){//已完成
string s="欢迎来到八宝粥行动!";
for(size_t i=0;i<s.size();i++){
cout<<s[i];
Sleep(20);
}
Sleep(100);
cout<<'\n';
s="制作人员:cyx,zzy";
for(size_t i=0;i<s.size();i++){
cout<<s[i];
Sleep(20);
}
Sleep(100);
cout<<'\n';
s="按下P开始游戏";
for(size_t i=0;i<s.size();i++){
cout<<s[i];
Sleep(20);
}
while(1){
if(GetKeyState('P')<0){
system("cls");
return ;
}
}
return ;
}
void chushimianban(){
while(1){
system("cls");
out("1.选择地图",20,1);
out("",0,1);
out("当前地图:"+dtmc[dt],20,1);
out("",0,1);
out("2.战备选择",20,1);
out("",0,1);
out("主武器1:"+zwqmc[zwq1],20,1);
out("主武器2:"+zwqmc[zwq2],20,1);
out("手枪:"+sqmc[sq],20,1);
out("刀:"+dmc[d],20,1);
out("",0,1);
out("3.开始行动",20,1);
while(1){
if(GetKeyState('1')<0){
xuanzeditu();
break;
}
if(GetKeyState('2')<0){
zhanbeixuanze();
break;
}
if(GetKeyState('3')<0){
kaishixingdong();
break;
}
}
}
}
void xuanzeditu(){
system("cls");
while(1){
for(int i=1;i<=dtsl;i++){
cout<<i;
Sleep(30);
out('.'+dtmc[i],20,1);
}
out("其他地图暂未开放",10,1);
while(1){
if(GetKeyState('1')<0){
dt=1;
return ;
}
}
}
return;
}
void zhanbeixuanze(){
while(1){
system("cls");
out("-----------------",10,1);
out("主武器1:"+zwqmc[zwq1],20,1);
out("主武器2:"+zwqmc[zwq2],20,1);
out("手枪:"+sqmc[sq],20,1);
out("刀:"+dmc[d],20,1);
out("-----------------",10,1);
out("1.选择主武器1",20,1);
out("2.选择主武器2",20,1);
out("3.选择手枪",20,1);
out("4.选择刀",20,1);
out("5.返回",20,1);
while(1){
if(GetKeyState('5')<0){
return ;
}
}
}
return;
}
void kaishixingdong(){
system("cls");
out("请选择干员:",20,1);
for(int i=1;i<=gysl;i++){
cout<<i;
Sleep(20);
out('.'+gymc[i],20,1);
}
while(1){
if(GetKeyState('1')<0){
gy=1;
break;
}
}
if(dt==1){
linghaodaba();
}
return;
}
void linghaodaba(){
system("cls");
int wjx=14;
int wjy=1;
while(1){
system("cls");
for(int i=0;i<16;i++){
for(int j=0;j<32;j++){
if(wjx==i&&wjy==j){
cout<<'@';
}else{
cout<<dtmx[1][i][j];
}
}
cout<<'\n';
}
if(GetKeyState('W')<0){
wjx--;
if(dtmx[1][wjx][wjy]=='#'|dtmx[1][wjx][wjy]=='~'||dtmx[1][wjx][wjy]=='-'){
wjx++;
}
}
if(GetKeyState('S')<0){
wjx++;
if(dtmx[1][wjx][wjy]=='#'|dtmx[1][wjx][wjy]=='~'||dtmx[1][wjx][wjy]=='-'){
wjx--;
}
}
if(GetKeyState('A')<0){
wjy--;
if(dtmx[1][wjx][wjy]=='#'|dtmx[1][wjx][wjy]=='~'||dtmx[1][wjx][wjy]=='-'){
wjy++;
}
}
if(GetKeyState('D')<0){
wjy++;
if(dtmx[1][wjx][wjy]=='#'|dtmx[1][wjx][wjy]=='~'||dtmx[1][wjx][wjy]=='-'){
wjy--;
}
}
if(dtmx[1][wjx][wjy]=='X'){
xingzhenglou();
wjx++;
}
Sleep(50);
}
return ;
}
void xingzhenglou(){
system("cls");
int wjx=14;
int wjy=1;
while(1){
system("cls");
for(int i=0;i<16;i++){
for(int j=0;j<32;j++){
if(wjx==i&&wjy==j){
cout<<'@';
}else{
cout<<dtmx[2][i][j];
}
}
cout<<'\n';
}
if(GetKeyState('W')<0){
wjx--;
if(dtmx[2][wjx][wjy]=='#'){
wjx++;
}
}
if(GetKeyState('S')<0){
wjx++;
if(dtmx[2][wjx][wjy]=='#'){
wjx--;
}
}
if(GetKeyState('A')<0){
wjy--;
if(dtmx[2][wjx][wjy]=='#'){
wjy++;
}
}
if(GetKeyState('D')<0){
wjy++;
if(dtmx[2][wjx][wjy]=='#'){
wjy--;
}
}
if(dtmx[2][wjx][wjy]=='X'){
return ;
}
Sleep(50);
}
return ;
}
void out(string s,int x,bool hh){//s要输出的,hh换不换行
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(0);
}
if(hh==1){
cout<<'\n';
}
Sleep(50);
}
void HideCursor() {
CONSOLE_CURSOR_INFO cursorInfo;
cursorInfo.dwSize = 1; // 光标大小(1-100)
cursorInfo.bVisible = FALSE; // 隐藏光标
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursorInfo);
}
int main(){
// double string a.length() unsigned long long memset(a,0,sizeof(a));
// freopen("?.in","r",stdin);scanf("%d",&a);
// freopen("?.out","w",stdout);printf("%d",a);
// ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
HideCursor();
kaishiyouxi();
chushimianban();
return 0;
}
//㊣