问题标题: 小李工作室:(升级)炸弹兵大战大力士1.0.1

1
1
已解决
李熙尧
李熙尧
新手光能
新手光能
​
//cout<<"玩家一asdw控制,z攻击;玩家二ijkl控制,m攻击";
#include<iostream>
#include<windows.h>
#include<ctime>
#include<conio.h>
using namespace std;
int mep[10][30]={{3,8,8,8,8,8,8,8,8,8,8,8,8,8,4},
                {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
                {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
                {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
                {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
                {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
                {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
                {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
                {1,2,0,0,0,0,0,0,0,0,0,0,0,9,1},
                {5,8,8,8,8,8,8,8,8,8,8,8,8,8,6}};
int mep1[10][30]={{3,8,8,8,8,8,8,8,8,8,8,8,8,8,4},
                {1,0,0,0,13,0,0,13,0,0,0,0,0,0,1},
                {1,0,0,0,13,11,0,13,0,0,0,0,0,0,1},
                {1,0,0,0,0,0,0,13,0,0,0,0,0,0,1},
                {1,0,0,0,13,11,0,13,0,0,0,0,0,0,1},
                {1,0,0,0,13,0,0,13,0,0,0,0,0,0,1},
                {1,0,0,0,13,0,11,13,0,0,0,0,0,0,1},
                {1,0,0,0,13,0,0,0,0,0,0,0,0,0,1},
                {1,2,0,0,13,0,0,13,0,0,0,0,0,9,1},
                {5,8,8,8,8,8,8,8,8,8,8,8,8,8,6}};
int f1=8,f2=1,d1=8,d2=13,nx,zz=10,x1=100,x2=200,zzm=2,_a=10,_b;
int vas(int dai){
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),dai);
}
int map[10][30];
///////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////

int mup();

void go1(){
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO CursorInfo;
    GetConsoleCursorInfo(handle, &CursorInfo);
    CursorInfo.bVisible = false;
    SetConsoleCursorInfo(handle, &CursorInfo);
}
int ko(int what,int wh);

int main(){
   go1();
    cout<<"    █       █         \n";
    cout<<"    █    ████           \n";
    cout<<"    █     ███         \n";
    cout<<"  ███  █   █ █  \n";
    cout<<" █ █ ██  █  █       \n";
    cout<<"█  █  █ ███             \n";
    cout<<"    █   █████       \n";
    cout<<" █ █       █        \n";
    cout<<"  ██     ██         \n";
    cout<<"    █       █    小李工作室  ";
    cout<<"荣誉出品";
    Sleep(5000);
    system("cls"); 
int MIN=1,MAX=36;
    cout<<"-----------------------------------选择地图----------------------------------------";
    cout<<"\n      1.原始旷野            2.死亡峡谷"; 
    int ch;
    cin>>ch;
    system("cls");
    double c;
    go1();
    int i=1;
    if(ch==1){
        for(int i=0;i<10;i++){
            for(int j=0;j<30;j++){
                map[i][j]=mep[i][j];
            }
        }
    }
    if(ch==2){
        for(int i=0;i<10;i++){
            for(int j=0;j<30;j++){
                map[i][j]=mep1[i][j];
            }
        }
    }       
    while(1){
        mup();
        cout<<"\n"<<"玩家一还剩"<<zz<<"枚地雷,"<<zzm<<"次地雷波"<<"\n"<<"玩家一血量:"<<x1<<"\n"<<"玩家二血量:"<<x2<<" "<<_a<<"次方块制造机会"; 
        nx=c;
        c=getch();
        if(c=='a'){
            if(map[f1][f2-1]==0){
                map[f1][f2]=0;
                map[f1][f2-1]=2;
                map[f1][f2]=0;
                f2--;
            }
            if(map[f1][f2-1]==2){
                map[f1][f2]=0;
                map[f1][f2-1]=2;
                map[f1][f2]=0;
                x1-=50;
                f2--;
            }
        }
        if(c=='d'){
            if(map[f1][f2+1]==0){
                map[f1][f2]=0;
                map[f1][f2+1]=2;
                map[f1][f2]=0;
                f2++;
            }
            if(map[f1][f2+1]==2){
                map[f1][f2]=0;
                map[f1][f2+1]=2;
                map[f1][f2]=0;
                x2-=50;
                f2++;
            }
        }
        if(c=='w'){
            if(map[f1-1][f2]==0){
                map[f1][f2]=0;
                map[f1-1][f2]=2;
                f1--;
            }
            if(map[f1-1][f2]==2){
                map[f1][f2]=0;
                map[f1-1][f2]=2;
                map[f1][f2]=0;
                x1-=50;
                f1--;
            }
        }
        if(c=='s'){
            if(map[f1+1][f2]==0){
                map[f1][f2]=0;
                map[f1+1][f2]=2;
                map[f1][f2]=0;
                f1++;
            }
            if(map[f1][f2-1]==2){
                map[f1][f2]=0;
                map[f1][f2-1]=2;
                map[f1][f2]=0;
                x1-=50;
                f1++;
            }
        }
        if(c=='j'){
            if(map[d1][d2-1]==0){
                map[d1][d2]=0;
                map[d1][d2-1]=9;
                map[d1][d2]=0;
                d2--;
            }
            if(map[d1][d2-1]==10){
                map[d1][d2]=0;
                map[d1][d2-1]=9;
                map[d1][d2]=0;
                d2--;
                x2-=50;
            }
        }
        if(c=='l'){
            if(map[d1][d2+1]==0){
                map[d1][d2]=0;
                map[d1][d2+1]=9;
                map[d1][d2]=0;
                d2++;
            }
            if(map[d1][d2+1]==10){
                map[d1][d2]=0;
                map[d1][d2+1]=9;
                map[d1][d2]=0;
                d2++;
                x2-=50;
            }
        }
        if(c=='i'){
            if(map[d1-1][d2]==0){
                map[d1][d2]=0;
                map[d1-1][d2]=9;
                d1--;
            }
            if(map[d1-1][d2]==10){
                map[d1][d2]=0;
                map[d1-1][d2]=9;
                map[d1][d2]=0;
                d1--;
                x2-=50;
            }
        }
        if(c=='k'){
            if(map[d1+1][d2]==0){
                map[d1][d2]=0;
                map[d1+1][d2]=9;
                map[d1][d2]=0;
                d1++;
            }
            if(map[d1+1][d2]==10){
                map[d1][d2]=0;
                map[d1+1][d2]=9;
                map[d1][d2]=0;
                d1++;
                x2-=50;
            }
        }
        if(c=='z'&&zz>0){
            if(nx=='a'){
                if(map[f1][f2-1]==0){
                    map[f1][f2-1]=10;
                    zz--;
                }

            }
            if(nx=='d'){
                if(map[f1][f2+1]==0){
                    map[f1][f2+1]=10;
                    zz--;   
                }

            }
            if(nx=='w'){
                if(map[f1-1][f2]==0){
                        map[f1-1][f2]=10;
                        zz--; 
                }

            }
            if(nx=='s'){
                if(map[f1+1][f2]==0){
                    map[f1+1][f2]=10;
                    zz--;
                }

            }
        }
        if(c=='x'&&zzm>0){
            zzm--;
            for(int i=0;i<=14;i++){
                if(nx=='a'||nx=='d'){
                if(map[f1][i]==0){
                    map[f1][i]=10;

                }

            }
            if(nx=='w'||nx=='s'){
                if(map[i][f2]==0){
                    map[i][f2]=10;  
                }

            }
            }

        } 
        if(c=='m'){
            if((map[d1-1][d2-1]==2||map[d1][d2-1]==2)||map[d1+1][d2-1]==2||map[d1-1][d2]==2||map[d1][d2]==2||map[d1+1][d2]==2||map[d1-1][d2+1]==2||map[d1][d2+1]==2||map[d1+1][d2+1]==2){
                srand((int)time(NULL));
                int ans=MIN+rand()%(MAX-MIN+1);
                if(ans<=30){
                    x1-=20;
                }
                else{
                    x1-=ans;
                }
            }
            if(map[d1][d2-1]==12){
                map[d1][d2-1]=0;
            }
            if(map[d1][d2+1]==12){
                map[d1][d2+1]=0;
            }
            if(map[d1+1][d2]==12){
                map[d1+1][d2]=0;
            }
            if(map[d1-1][d2]==12){
                map[d1-1][d2]=0;
            }
        } 
        if(c=='n'&&_a>0){

                int ss=0,sss=14,bb=0,bbb=9;
                srand((int)time(NULL));
                int ans1=ss+rand()%(sss-ss+1);
                srand((int)time(NULL));
                int ans2=bb+rand()%(bbb-bb+1);
                if(map[ans1][ans2]==0){
                    map[ans1][ans2]=12;
                    _a--;
            }
        }
        if(x1<=0){
            ko(0,1);
            return 0;
        }
        if(x2<=0){
            ko(1,1);
            return 0;
        }
        system("cls");

    }

    return 0;
} 
int mup(){
    for(int i=0;i<10;i++){
        for(int j=0;j<30;j++){
            if(map[i][j]==0){
                cout<<"  ";
            }
            if(map[i][j]==1){
                cout<<"┃";
            }
            if(map[i][j]==2){
                cout<<"♀";
            }
            if(map[i][j]==3){
                cout<<"┏";
            }
            if(map[i][j]==4){
                cout<<"┓";
            }
            if(map[i][j]==5){
                cout<<"┗";
            }
            if(map[i][j]==6){
                cout<<"┛";
            }
            if(map[i][j]==8){
                cout<<"━━";
            }if(map[i][j]==9){
                cout<<"♂";
            }
            if(map[i][j]==10){
                vas(250);
                cout<<"!!";
                vas(7);
            }
            if(map[i][j]==11){
                cout<<"**";
            }
            if(map[i][j]==12){
                cout<<"::"; 
            }
            if(map[i][j]==13){
                cout<<"┃ ";
            }
            if(map[i][j]==14){
                cout<<"△"; 
            }
        }
        cout<<"\n";
    }
}
int ko(int what,int wh){
    system("cls");
    if(wh==1){
        mup();
    cout<<"\n"<<"";
    if(what==0){
        cout<<"玩家二胜利!!!";
        map[f1][f2]=11; 
    }
    if(what==1){
        cout<<"玩家一胜利!!!";
        map[d1][d2]=11; 
    }
    }

}

​
升级内容:
   1.增加地图
   2.更新系统

 


0
0
徐智勋
徐智勋
初级光能
初级光能

徐智勋在2021-08-04 13:56:18追加了内容

0
王梓澳
王梓澳
中级光能
中级光能

建议用SetPos,可以避免闪烁,还有写个介绍。。。

我一脸懵,不知道怎么玩

0
0
0
0
0
0
2077
2077
初级守护
初级守护

“起初没有人在意这场**难,直到它和每个人息息相关。”

现在,为了水贴,已经到了不得不的时候了!

为我们,为水贴:

去**,要图⽚,⽀持我的来转发!

0
我要回答