问题标题: 盗版MC 2D代码

2
1
已解决
被禁言 马博闻
马博闻
初级守护
初级守护

复制到DEV C++ 

#include <iostream>
#include <conio.h>
#include <windows.h>
using namespace std;
void Color(int a){//颜色控制函数(部分代码为复制) 
    if(a==0)  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);//标准 
    if(a==1)  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);               //浅蓝 
    if(a==2)  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);                               //绿
    if(a==3)  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);                 //紫红 
    if(a==4)  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);                                 //浅橙 
    if(a==5)  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);                //浅黄 
    if(a==6)  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);                                //蓝 
    if(a==7)  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);                     //浅灰 
    if(a==8)  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);                                                      //红
    if(a==9)  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_GREEN|BACKGROUND_BLUE);               //浅蓝  外 
    if(a==10) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|BACKGROUND_RED|BACKGROUND_BLUE);                 //紫红  外 
    if(a==11) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);                                      //深紫 
    if(a==12) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_GREEN);                                     //棕黄 
    if(a==13) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);                                                //深灰 
    if(a==14) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_BLUE);                                    //较浅蓝 
    return;
}
struct map_s{
    int flag;
    string s;
}map[105][505];
struct pla_s{
    int x,y;
}pl;
string blo[10]={"","##","&&","--","//","\\\\","||","%%"," a"};
int blo_cnt=1;
string now_blo="##";
void CSH(){
    pl.x=79;
    pl.y=11;
    for(int i=1;i<=100;i++){
        for(int j=1;j<=500;j++){
            if(i<80)     map[i][j].s="  ";
            else if(i<85)    map[i][j].s="&&";
            else            map[i][j].s="##";
        }
    }
}
void SC(){
    system("cls");
    Color(5);
    for(int i=1;i<=22;i++)cout<<"++";
    cout<<endl;
    for(int i=pl.x-10;i<=pl.x+10;i++){
        Color(5);
        cout<<"+";
        for(int j=pl.y-10;j<=pl.y+10;j++){
            if(i<=0||j<=0||i>=100||j>=500)continue;
            if(i==pl.x&&j==pl.y){
                Color(0);
                cout<<"Yo";
            }else{
                if(map[i][j].s=="&&")Color(12);
                if(map[i][j].s=="##")Color(13);
                if(map[i][j].s=="--")Color(6);
                if(map[i][j].s=="%%")Color(2);
                if(map[i][j].s==" a")Color(8);
                if(map[i][j].s=="||"||map[i][j].s=="//"||map[i][j].s=="\\\\")Color(4);
                cout<<map[i][j].s;
            }
        }
        Color(5);
        cout<<"+";
        cout<<endl;
    }
    Color(5);
    for(int i=1;i<=22;i++)cout<<"++";
    Color(0);
    cout<<endl<<"Your Block:";
    if(now_blo=="&&")Color(12);
    if(now_blo=="##")Color(13);
    if(now_blo=="--")Color(6);
    if(now_blo=="%%")Color(2);
    if(now_blo==" a")Color(8);
    if(now_blo=="||"||now_blo=="//"||now_blo=="\\\\")Color(4);
    cout<<now_blo;
    return;
}
int main(){
    CSH();
    SC();
    while(1){
        char c=getch();
        if(c=='w'&&pl.x>11)pl.x--;
        if(c=='s'&&pl.x<89)pl.x++;
        if(c=='a'&&pl.y>11)pl.y--;
        if(c=='d'&&pl.y<489)pl.y++;
        if(c=='t')map[pl.x][pl.y].s=now_blo;
        if(c=='y')map[pl.x][pl.y].s="  ";
        if(c=='h'&&blo_cnt<8)blo_cnt++;
        if(c=='g'&&blo_cnt>1)blo_cnt--;
        now_blo=blo[blo_cnt];
        SC();
    }
    return 0;
}

按 w s a d 移动

按 g h 切换方块

按 t y  放置/删除方块


0
已采纳
沙宸安
沙宸安
高级启示者
高级启示者

XACRAFT发布于2021年,2020年的人们:

0
吴奕鸣
吴奕鸣
修练者
修练者

xacraft3.5部分代码

原来4040行,你们补不过来

 

 

#include<iostream>
#include<fstream> 
#include<windows.h>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include<conio.h>
#include<sstream>
#include<time.h>
#include<vector> 
#include<stdio.h>
#include<stdlib.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0) 
using namespace std;
bool allowsave=1;
bool jiandang[21];//½¨Á¢´æµµ 
string nam,pas,sq;
void console()
{
    system("mode con:cols=81 lines=25");
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);  
    CONSOLE_SCREEN_BUFFER_INFO bInfo; 
    GetConsoleScreenBufferInfo(hOut, &bInfo );  
    SetConsoleTitle("XACRAFT 3.5 ¼òÌåÖÐÎİæ"); // ÉèÖô°¿ÚµÄ±êÌâ
}
struct han{
    int ui,num;
}hand[21][50],rl[51];
struct pflist{
    int num;
    han k[101];
    han sum;
}lis[10001],rlis[10001];
struct blocklist{
    string nam,ape;
    int pps,cor,hylink,maxl,mintim,pene;
}bl[10001];
struct Eclist{
    string ecs,nam,notice;
    int jb,lin,emc;
}eclis[10001];
string xapas,xanam,xapin;
char ch;
int errortimes=0;
string pfd="10";//Ƥ·ô 
long long jb=100;//½ð±ÒÊýÁ¿ 
int a[21][5][256][4097],x[21]={0},y[21],jie[21],cx[21],cy[21],ran[21],mode[21],xuanze=0,lisn,rlisn,rln,eclisn,emc,dek,highlowdown,playing;
int smz[21],jed[21];
int days[21],tims[21],chuancan,chuandang;
int i,j,kkk;
bool kn=0,echave[10001];
char cmmd;
string comd,savnam[21];
int seed;
bool bpf[51];
string pfs[10]={"XA","BM","SP","MC","…d","¡ò","¡÷","¡ó","¡õ","0 "};
string waitingnotice[100]={
    "XACRAFT 1.0°æ±¾·¢²¼ÓÚ2021Äê2ÔÂ12ÈÕ",
    "XACRAFT¸Õ¸Õµ®Éúʱ£¬´úÂëÐÐÊý²»³¬¹ý150ÐУ¡",
    "½ðÆ»¹ûµÄÉú³É¸ÅÂʽöΪ0.05%",
    "Äã»á·¢ÏÖ£¬ËùÓеÄXACRAFTÉúÎïȺϵ¶¼ÓÐÖ²ÎïÉú³É£¡",
    "¼ÓÈëXACRAFTÉçÇø£¬Óë»ï°é½»Á÷XACRAFTµÄÓÎÏ·¼¼ÇÉ£¡",
    "²»Òª¿¿½üÏÉÈËÕÆ£¡",
    "Éú´æÄ£Ê½ÖУ¬°´ÏÂL¼ü¼´¿É²é¿´×´Ì¬À¸¡£",
    "¼¢¶öֵСÓÚ30ʱ£¬ÉúÃüÖµ½«²»»á»Ö¸´£¡",
    "¶àÊÕ¼¯Ò»Ð©Æ»¹û£¬ÕâÑù²Å²»»á°¤¶ö¡£",
    "×êʯ¿óʯµÄÉú³É×î¸ß¸ß¶ÈΪ16¡£"
};
int pfp[10]={0,50,50,100,150,150,150,150,150,300},sehao=240,pfn=10;
int shop[21][21]=
{
    { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 },
    { 1,0,0,0,0,0,0,0,0,11,27,11,0,0,0,0,0,0,0,0,1 },
    { 1,0,0,0,0,0,0,0,0,11,27,11,0,0,0,0,0,0,0,0,1 },
    { 1,0,0,17,17,17,0,0,0,11,27,11,0,0,0,18,18,18,0,0,1 },
    { 1,0,0,17,6,17,0,0,0,11,27,11,0,0,0,18,15,18,0,0,1 },
    { 1,0,0,17,17,17,0,0,0,11,27,11,0,0,0,18,18,18,0,0,1 },
    { 1,0,0,0,0,0,0,0,0,11,27,11,0,0,0,0,0,0,0,0,1 },
    { 1,0,0,0,0,0,0,0,0,11,27,11,0,0,0,0,0,0,0,0,1 },
    { 1,0,0,0,0,0,0,0,0,11,27,11,0,0,0,0,0,0,0,0,1 },
    { 1,11,11,11,11,11,11,11,11,11,27,11,11,11,11,11,11,11,11,11,1 },
    { 1,27,27,27,27,27,27,27,27,27,7,27,27,27,27,27,27,27,27,27,1 },
    { 1,11,11,11,11,11,11,11,11,11,27,11,11,11,11,11,11,11,11,11,1 },
    { 1,0,0,0,0,0,0,0,0,11,27,11,0,0,0,0,0,0,0,0,1 },
    { 1,0,0,0,0,0,0,0,0,11,27,11,0,0,0,0,0,0,0,0,1 },
    { 1,0,0,0,0,0,0,0,0,11,27,11,0,0,0,0,0,0,0,0,1 },
    { 1,0,0,29,29,29,0,0,0,11,27,11,0,0,0,13,13,13,0,0,1 },
    { 1,0,0,29,28,29,0,0,0,11,27,11,0,0,0,13,14,13,0,0,1 },
    { 1,0,0,29,29,29,0,0,0,11,27,11,0,0,0,13,13,13,0,0,1 },
    { 1,0,0,0,0,0,0,0,0,11,27,11,0,0,0,0,0,0,0,0,1 },
    { 1,0,0,0,0,0,0,0,0,11,27,11,0,0,0,0,0,0,0,0,1 },
    { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 },
};
void color(int corcorcor){
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),corcorcor);
}
bool kd(char ccc){
    if(!KEY_DOWN(ccc)) return 0;
    else return 1;
}
int rdm(int aaaaa,int bbbbb){
    return rand()%(bbbbb-aaaaa+1)+aaaaa;
}
void cls(){//ÚSÐ̵ÀÌṩ£¬ÈçÓÐÇÖȨÇëÁªÏµÉ¾³ý¡£    
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coordScreen = { 0, 0 };    // home for the cursor
    SetConsoleCursorPosition( hConsole, coordScreen );
}
char gl(){
    if(kd('Q')) return 'Q';
    if(kd('W')) return 'W';
    if(kd('E')) return 'E';
    if(kd('R')) return 'R';
    if(kd('T')) return 'T';
    if(kd('Y')) return 'Y';
    if(kd('U')) return 'U';
    if(kd('I')) return 'I';
    if(kd('O')) return 'O';
    if(kd('P')) return 'P';
    if(kd('A')) return 'A';
    if(kd('S')) return 'S';
    if(kd('D')) return 'D';
    if(kd('F')) return 'F';
    if(kd('G')) return 'G';
    if(kd('H')) return 'H';
    if(kd('J')) return 'J';
    if(kd('K')) return 'K';
    if(kd('L')) return 'L';
    if(kd('Z')) return 'Z';
    if(kd('X')) return 'X';
    if(kd('C')) return 'C';
    if(kd('V')) return 'V';
    if(kd('B')) return 'B';
    if(kd('N')) return 'N';
    if(kd('M')) return 'M';
    if(kd('1')) return '1';
    if(kd('2')) return '2';
    if(kd('3')) return '3';
    if(kd('4')) return '4';
    if(kd('5')) return '5';
    if(kd('6')) return '6';
    if(kd('7')) return '7';
    if(kd('8')) return '8';
    if(kd('9')) return '9';
    if(kd('0')) return '0';
}

0
毕博雨
毕博雨
资深光能
资深光能

发照片也能复制?(不懂就问)

0
0
杨骐宇
杨骐宇
中级光能
中级光能

全是回忆😭😭😭  

这不是以前的...      

怀念那段时光

2022/12---2023/4

 

0
0
0
0
0
0
0
0
我要回答