问题标题: 酷町堂:@李熙尧

0
0
已解决
郑泓毅
郑泓毅
资深守护
资深守护

#include<iostream>
#include<windows.h>
using name** std;
int x,xl_1=200,xl_2=200,bj1=3,bj2=9;
int x1,y1,x2,y2,px,py,qx,qy,a;
bool vis[25][25];
int map[105][20][20]={{0},{{0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,4,0,0,0,0,0,0,0,0,0,0,0,5,1},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
    },{{0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,1,1,0,0,0,0,1,0,1,0,1},
        {0,1,0,0,0,1,1,1,1,0,0,1,0,0,0,1},
        {0,1,0,0,0,1,1,1,1,0,0,1,0,1,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1},
        {0,1,0,1,1,0,0,1,0,1,0,0,0,0,0,1},
        {0,1,0,1,1,0,0,1,0,1,0,0,0,0,0,1},
        {0,1,0,0,1,0,0,0,0,0,0,0,1,1,0,1},
        {0,1,4,0,1,0,0,0,0,0,0,0,0,1,5,1},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
    },{{0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
        {0,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1},
        {0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1},
        {0,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1},
        {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,1,1,1,1,1,0,0,0,0,1},
        {0,1,0,0,0,0,1,1,1,0,0,0,0,0,0,1},
        {0,1,0,0,0,0,1,0,1,0,1,0,0,0,0,1},
        {0,1,0,0,1,0,1,0,0,0,1,0,0,0,0,1},
        {0,1,0,0,1,0,1,0,1,1,1,0,0,0,0,1},
        {0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,1},
        {0,1,0,0,1,1,1,0,0,0,0,0,1,0,0,1},
        {0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,1},
        {0,1,4,1,1,1,0,0,1,0,0,1,1,1,5,1},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
    }
};//0:空地 1:墙 2:地雷 3:方块 4:玩家1 5:玩家2 
void cls(){    
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coordScreen = { 0, 0 };    // home for the c**sor
    SetConsoleC**sorPosition( hConsole, coordScreen );
}
void gol(){
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_C**SOR_INFO C**sorInfo;
    GetConsoleC**sorInfo(handle,&C**sorInfo);
    C**sorInfo.bVisible = false;
    SetConsoleC**sorInfo(handle,&C**sorInfo);
}
void xinxi(){
    cout<<"暴击"<<bj1<<" 玩家1:";
    if(xl_1>=100) cout<<xl_1<<endl;
    else if(xl_1>=10) cout<<"0"<<xl_1<<endl;
    else cout<<"00"<<xl_1<<endl;
    cout<<"砖头"<<bj2<<" 玩家2:";
    if(xl_2>=100) cout<<xl_2<<endl;
    else if(xl_2>=10) cout<<"0"<<xl_2<<endl;
    else cout<<"00"<<xl_2<<endl;
}
int main(){
    cout<<"1.普通地图 2.乱石地图 3.山林生存"<<endl;
    cin>>x;
    Sleep(500);
    **("cls");
    while(true){
        gol();
        for(int i=1;i<=15;i++){
            for(int j=1;j<=15;j++){
                if(map[x][i][j]==0){
                    cout<<"□";
                }else if(map[x][i][j]==1){
                    cout<<"■";
                }else if(map[x][i][j]==2){
                    cout<<"雷";
                }else if(map[x][i][j]==3){
                    cout<<"∷";
                }else if(map[x][i][j]==4){
                    cout<<"11";
                    x1=i,y1=j;
                }else if(map[x][i][j]==5){
                    cout<<"22";
                    x2=i,y2=j;
                }
            }
            cout<<endl;
        }
        //0:空地 1:墙 2:地雷 3:方块 4:玩家1 5:玩家2 
        if(GetAsyncKeyState('W')&&(map[x][x1-1][y1]==0||map[x][x1-1][y1]==2)){
            if(map[x][x1-1][y1]==2){
                map[x][x1-1][y1]=0;
                xl_1-=20;
            }
            map[x][x1][y1]=0;
            map[x][x1-1][y1]=4;
            px=-1,py=0;
        }
        else if(GetAsyncKeyState('S')&&(map[x][x1+1][y1]==0||map[x][x1+1][y1]==2)){
            if(map[x][x1+1][y1]==2){
                map[x][x1+1][y1]=0;
                xl_1-=20;
            }
            map[x][x1][y1]=0;
            map[x][x1+1][y1]=4;
            px=1,py=0;
        }
        else if(GetAsyncKeyState('A')&&(map[x][x1][y1-1]==0||map[x][x1][y1-1]==2)){
            if(map[x][x1][y1-1]==2){
                map[x][x1][y1-1]=0;
                xl_1-=20;
            }
            map[x][x1][y1]=0;
            map[x][x1][y1-1]=4;
            px=0,py=-1;
        }
        else if(GetAsyncKeyState('D')&&(map[x][x1][y1+1]==0||map[x][x1][y1+1]==2)){
            if(map[x][x1][y1+1]==2){
                map[x][x1][y1+1]=0;
                xl_1-=20;
            }
            map[x][x1][y1]=0;
            map[x][x1][y1+1]=4;
            px=0,py=1;
        }else if(GetAsyncKeyState('E')&&bj1>=1&&!vis[x1][y1]){
            a=rand()%2+1;
            if(a==1){
                for(int i=1;i<=15;i++){
                    if(map[x][x1][i]==0){
                        map[x][x1][i]=2;
                    }
                }
            }else{
                for(int i=1;i<=15;i++){
                    if(map[x][i][y1]==0){
                        map[x][i][y1]=2;
                    }
                }
            }
            bj1--;
            vis[x1][y1]=false;
        }else if(GetAsyncKeyState('Q')){
            if(map[x][x1+px][y1+py]==0){
                map[x][x1+px][y1+py]=2;
            }
        }
        //0:空地 1:墙 2:地雷 3:方块 4:玩家1 5:玩家2 
        if(GetAsyncKeyState('I')&&(map[x][x2-1][y2]==0||map[x][x2-1][y2]==2)){
            if(map[x][x2-1][y2]==2){
                map[x][x2-1][y2]=0;
                xl_2-=30;
            }
            map[x][x2][y2]=0;
            map[x][x2-1][y2]=5;
            qx=-1,qy=0;
        }
        else if(GetAsyncKeyState('K')&&(map[x][x2+1][y2]==0||map[x][x2+1][y2]==2)){
            if(map[x][x2+1][y2]==2){
                map[x][x2+1][y2]=0;
                xl_2-=30;
            }
            map[x][x2][y2]=0;
            map[x][x2+1][y2]=5;
            qx=1,qy=0;
        }
        else if(GetAsyncKeyState('J')&&(map[x][x2][y2-1]==0||map[x][x2][y2-1]==2)){
            if(map[x][x2][y2-1]==2){
                map[x][x2][y2-1]=0;
                xl_2-=30;
            }
            map[x][x2][y2]=0;
            map[x][x2][y2-1]=5;
            qx=0,qy=-1;
        }
        else if(GetAsyncKeyState('L')&&(map[x][x2][y2+1]==0||map[x][x2][y2+1]==2)){
            if(map[x][x2][y2+1]==2){
                map[x][x2][y2+1]=0;
                xl_2-=30;
            }
            map[x][x2][y2]=0;
            map[x][x2][y2+1]=5;
            qx=0,qy=1;
        }else if(GetAsyncKeyState('U')){
            if(abs((x1+y1)-(x2+y2))<=2){
                a=rand()%10+1;
                xl_1-=a;
            }
        }else if(GetAsyncKeyState('O')){
            if(map[x][x2+qx][y2+qy]==0&&bj2>=0){
                map[x][x2+qx][y2+qy]=3;
            }
        }else if(GetAsyncKeyState('P')){
            for(int i=x2-1;i<=x2+1;i++){
                for(int j=y2-1;j<=y2+1;j++){
                    if(map[x][i][j]==3){
                        bj2++;
                        map[x][i][j]=0;
                    }
                }
            }
        }
        xinxi();
        cls();
        if(xl_1<=0||xl_2<=0){
            break;
        }
    }
    **("cls");
    if(xl_1<=0) cout<<"玩家2赢了";
    else cout<<"玩家1赢了";
    ret**n 0;
}


0
1
王文博
王文博
缔造者之神
缔造者之神

游戏的名称?

另外,这个游戏为什么要@一个人???????

我不知道为什么

0
0
郑泓毅
郑泓毅
资深守护
资深守护

**("cls");         s y s t e m ( " c l s " ) ;

using name** std;          u s i n g     n a m e s p a c e       s t d ;

函数:

void cls(){    
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coordScreen = { 0, 0 }; 
    SetConsoleC( ** )sorPosition( hConsole, coordScreen );
}
v o i d   g o l ( ) {
    H A N D L E   h a n d l e   =   G e t S t d H a n d l e ( S T D _ O U T P U T _ H A N D L E ) ;
    C O N S O L E _ C ** S O R _ I N F O   C ** s o r I n f o ;
    G e t C o n s o l e C ** s o r I n f o ( h a n d l e , & C ** s o r I n f o ) ;
    C ** s o r I n f o . b V i s i b l e   =   f a l s e ; 
    S e t C o n s o l e C ** s o r I n f o ( h a n d l e , & C ** s o r I n f o ) ;
}

郑泓毅在2021-08-05 09:39:09追加了内容

**是

(u)(r)

gor函数第一个是大写,其余全是小写

0
苏屹冉
苏屹冉
初级光能
初级光能

**("cls");

using name** std;

都变成**了

0
0
我要回答