| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1453 人关注过本帖, 1 人收藏
标题:请教大佬做一下游戏的墙壁系统,谢谢!
只看楼主 加入收藏
狮子头
Rank: 2
等 级:论坛游民
帖 子:17
专家分:10
注 册:2021-5-22
结帖率:66.67%
收藏(1)
已结贴  问题点数:14 回复次数:3 
请教大佬做一下游戏的墙壁系统,谢谢!
最近在写游戏,但游戏的墙壁既不能被穿过,又要添加可破坏的属性,请教大佬怎么写?(总而言之就是出了人物,其他字符不允许被覆盖)
代码:
程序代码:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
#include <time.h>
#include <string.h>




HANDLE hout; 
int hand = 1;
int ti,tim,tin,tie,tik;
int yz,xz,xx,yx;
char get1[43]={0},get2[86]={0},get3[559]={0};
void gotoxy(int x,int y)              
{
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD pos;
    pos.X = x;
    pos.Y = y;
    SetConsoleCursorPosition(handle,pos);
}
void printmap()
{
    gotoxy(12,0);
    printf("┌─────┬─────┬─────┬─────┐\n");
    gotoxy(12,1);
    printf("│ 1:木块  │ 2:泥土  │ 3:石头  │ 4:草块  │\n");
    gotoxy(12,2);
    printf("└─────┴─────┴─────┴─────┘\n");
    printf("\n\n\n----------------------------------------------------------------------------");
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN); 
    gotoxy(0,24);
    printf("############################################################################");
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED);
    printf("####################################################################################################################################################################################################################################");
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
    printf("################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################");
    gotoxy(3,25);
}
void printp()
{
    xz=3;
    yz=25;
    yz=yz-4;
    system("cls");
    printmap();
    gotoxy(xz,yz);
    printf("0\b");
    yz=yz+1;
    gotoxy(xz,yz);
    printf("\b\b-[0]-");
    yz=yz+1;
    gotoxy(xz,yz);
    printf("\b| |");
    gotoxy(3,25);
}
//获得输入
char getInput()
{
    int ch;//输入字符串
    COORD coord;//屏幕上的坐标
    CONSOLE_SCREEN_BUFFER_INFO csbi;//控制台屏幕缓冲区信息
    coord.X=10;
    coord.Y=10;
    ch=getch();
    //0x0d表示回车,0XE0表示上下左右等键的键码
    while(ch==0xE0||ch==0x0d||ch=='w'||ch=='s'||ch=='a'||ch=='d'||ch=='j'||ch=='l'||ch=='k'||ch=='i'||ch=='b')
    {
        GetConsoleScreenBufferInfo(hout,&csbi);
        coord.X=csbi.dwCursorPosition.X;//得到坐标X的值
        coord.Y=csbi.dwCursorPosition.Y;//得到坐标Y的值
        ch=getch();
        xz=coord.X;
        yz=coord.Y;
        if(ch=='b')
        {
            xz=coord.X;
            yz=coord.Y;
            gotoxy(0,4);
            CONSOLE_CURSOR_INFO cursor_info = {1,1};
            SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
            int chse;
            printf("请输入物品对应的数字以手持这个物品:");
            scanf("%d",&chse);
            if(chse==1||chse==2)
            {
                hand=1;
                gotoxy(0,4);
                printf("                                      ");
                gotoxy(xz,yz);
                CONSOLE_CURSOR_INFO cursor_info = {1,0};
                SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
            }
            if(chse==3)
            {
                hand=2;
                gotoxy(0,4);
                printf("                                      ");
                gotoxy(xz,yz);
                CONSOLE_CURSOR_INFO cursor_info = {1,0};
                SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
            }
            if(chse==4)
            {
                hand=3;
                gotoxy(0,4);
                printf("                                      ");
                gotoxy(xz,yz);
                CONSOLE_CURSOR_INFO cursor_info = {1,0};
                SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
            }
        }
        if(yz==41)
        {
            char die;
            system("cls"); 
            gotoxy(24,16);
            printf("          你死了!");
            gotoxy(20,20);
            printf("死亡原因:你不应该到这层来的,你掉出了这个游戏。");
            gotoxy(22,22);
            printf("按空格键重生,按“ESC”键退出游戏。");
            die=getch();
            if(die==' ')
            {
                ShellExecute(NULL,"open","2D创造游戏.exe",NULL,NULL,SW_SHOW);
                exit(0);
            }
            if(die==0x1B)
            {
                exit(0);
            }
        }
        if(ch=='j')
        {
            if(hand==1)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED);
            }
            if(hand==2)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
            }
            if(hand==3)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
            }
            xz=coord.X;
            yz=coord.Y;
            xx=xz;
            yx=yz;
            yx=yx-2;
            xx=xx-3;
            gotoxy(xx,yx);
            printf("#");
            yx=yx-1;
            gotoxy(xx,yx);
            printf("#");
            yx=yx-1;
            gotoxy(xx,yx);
            printf("#");
            xz=xz+1;
            gotoxy(xz,yz);
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
        }
        if(ch=='l')
        {
            if(hand==1)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED);
            }
            if(hand==2)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
            }
            if(hand==3)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
            }
            xz=coord.X;
            yz=coord.Y;
            xx=xz;
            yx=yz;
            yx=yx-2;
            xx=xx+3;
            gotoxy(xx,yx);
            printf("#");
            yx=yx-1;
            gotoxy(xx,yx);
            printf("#");
            yx=yx-1;
            gotoxy(xx,yx);
            printf("#");
            xz=xz+1;
            gotoxy(xz,yz);
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
        }
        if(ch=='k')
        {
            if(hand==1)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED);
            }
            if(hand==2)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
            }
            if(hand==3)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
            }
            yz=coord.Y;
            xz=coord.X;
            xx=xz;
            yx=yz;
            xx=xx-2;
            yx=yx-1;
            gotoxy(xx,yx);
            printf("#####");
            gotoxy(xz,yz);
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
        }
        if(ch=='i')
        {
            if(hand==1)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED);
            }
            if(hand==2)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
            }
            if(hand==3)
            {
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
            }
            yz=coord.Y;
            xz=coord.X;
            xx=xz;
            yx=yz;
            xx=xx-2;
            yx=yx-5;
            gotoxy(xx,yx);
            printf("#####");
            gotoxy(xz,yz);
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
        }
         if(ch=='a')
         {
             if(coord.X!=0)
            {
                xz=coord.X;
                yz=coord.Y;
                gotoxy(0,0);
                printf("挖掘中...");
                Sleep(600);
                printf("\b\b\b\b\b\b\b\b\b         ");
                gotoxy(xz,yz);
                coord.X--;
                xz=coord.X;
                yz=coord.Y;
                yz=yz-4;
                gotoxy(xz,yz);
                printf("\b\b  0   ");
                yz=yz+1;
                gotoxy(xz,yz);
                printf("\b\b-[0]- ");
                yz=yz+1;
                gotoxy(xz,yz);
                printf("\b\b | |  ");
            }
        }
        if(ch=='d')
        {
            if(coord.X!=79)
            {
                xz=coord.X;
                yz=coord.Y;
                gotoxy(0,0);
                printf("挖掘中...");
                Sleep(1500);
                printf("\b\b\b\b\b\b\b\b\b         ");
                gotoxy(xz,yz);
                xz=coord.X;
                yz=coord.Y;
                yz=yz-4;
                gotoxy(xz,yz);
                printf("\b\b   0  \b\b\b");
                yz=yz+1;
                gotoxy(xz,yz);
                printf("\b\b -[0]-");
                yz=yz+1;
                gotoxy(xz,yz);
                printf("\b\b  | | \b");
                coord.X++;
            }
            else
            {
                coord.X=0;
                coord.Y++;
            }
        }
        if(ch=='w')
        {
            xz=coord.X;
            yz=coord.Y;
            yz=yz-5;
            gotoxy(xz,yz);
            printf("0\b");
            yz=yz+1;
            gotoxy(xz,yz);
            printf("\b\b-[0]-");
            yz=yz+1;
            gotoxy(xz,yz);
            printf("\b\b | | ");
            yz=yz+1;
            gotoxy(xz,yz);
            while(1)
            {
                if(hand==1)
                {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED);
                }
                if(hand==2)
                {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
                }
                if(hand==3)
                {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);
                }
                break;
            }
            printf("\b\b  # ");
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_BLUE);
            coord.Y--;
            exit1:; 
        }
        if(ch=='s')
        {
            xz=coord.X;
            yz=coord.Y;
            gotoxy(0,0);
            printf("挖掘中...");
            Sleep(850);
            printf("\b\b\b\b\b\b\b\b\b         ");
            gotoxy(xz,yz);
            xz=coord.X;
            yz=coord.Y;
            gotoxy(xz-2,yz-4);
            printf("     ");
            gotoxy(xz-2,yz-3);
            printf("     ");
            gotoxy(xz-2,yz-2);
            printf("     ");
            gotoxy(xz-2,yz-1);
            printf("     ");
            yz=yz-3;
            gotoxy(xz,yz);
            printf("\b\b  0  \b\b\b\b\b");
            yz=yz+1;
            gotoxy(xz,yz);
            printf("\b\b-[0]-");
            yz=yz+1;
            gotoxy(xz,yz);
            printf("\b\b | | ");
            coord.Y++;
        }
        //
        if(ch==0x4b)
        {
            if(coord.X!=0)
            {
                coord.X--;
                xz=coord.X;
                yz=coord.Y;
                yz=yz-4;
                gotoxy(xz,yz);
                printf("0 ");
                yz=yz+1;
                gotoxy(xz,yz);
                printf("\b\b-[0]- ");
                yz=yz+1;
                gotoxy(xz,yz);
                printf("\b| | ");
            }
        }
        //
        else if(ch==0x4d)
        {
            if(coord.X!=79)
            {
                xz=coord.X;
                yz=coord.Y;
                yz=yz-4;
                gotoxy(xz,yz);
                printf(" 0\b");
                yz=yz+1;
                gotoxy(xz,yz);
                printf("\b\b -[0]-");
                yz=yz+1;
                gotoxy(xz,yz);
                printf("\b | |");
                coord.X++;
            }
            else if(coord.X==19)
            {
                xz=coord.X;
                yz=coord.Y;
                xz=xz-3;
                gotoxy(xz,yz);
            }
        }
        SetConsoleCursorPosition(hout,coord);
        ch=getch();
    }
    die:; 
    return ch;
}

 
void main()
{
    loop:;
    CONSOLE_CURSOR_INFO cursor_info = {1,0};
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
    COORD coord;//屏幕上的坐标
    CONSOLE_SCREEN_BUFFER_INFO csbi;//控制台屏幕缓冲区信息
    coord.X=10;
    coord.Y=10;
    GetConsoleScreenBufferInfo(hout,&csbi);
    coord.X=csbi.dwCursorPosition.X;//得到坐标X的值
    coord.Y=csbi.dwCursorPosition.Y;//得到坐标Y的值
    system("mode con cols=76 lines=42");
    int ch;
    system("cls"); 
    printp();
    hout=GetStdHandle(STD_OUTPUT_HANDLE);
    //从键盘获取输入,如果是方向键则执行方向功能,如果是回车键则换行,如果是字符则输出
    while(1)
    {
        ch=getInput();
        if (ch==' ')
        {
            COORD coord;//屏幕上的坐标
            CONSOLE_SCREEN_BUFFER_INFO csbi;//控制台屏幕缓冲区信息
            coord.X=10;
            coord.Y=10;
            GetConsoleScreenBufferInfo(hout,&csbi);
            coord.X=csbi.dwCursorPosition.X;//得到坐标X的值
            coord.Y=csbi.dwCursorPosition.Y;//得到坐标Y的值
            xz=coord.X;
            yz=coord.Y;
            yz=yz-4;
            gotoxy(xz-1,yz);
            printf("  ");
            gotoxy(xz-2,yz+1);
            printf("     ");
            gotoxy(xz-1,yz+2);
            printf("    ");
            yz=yz-3;
            yz=yz+1;
            gotoxy(xz-2,yz);
            printf("  0  \b\b\b");
            yz=yz+1;
            gotoxy(xz,yz);
            printf("\b\b-[0]-");
            yz=yz+1;
            gotoxy(xz,yz);
            printf("\b\b | | ");
            Sleep(250);
            gotoxy(xz-2,yz-2);
            printf("     ");
            gotoxy(xz-2,yz-1);
            printf("     ");
            gotoxy(xz-2,yz);
            printf("     ");
            gotoxy(xz,yz);
            printf("\b    \b\b\b0\b");
            yz=yz+1;
            gotoxy(xz,yz);
            printf("\b\b-[0]-");
            yz=yz+1;
            gotoxy(xz,yz);
            printf("\b| |");
            yz=yz+2;
            gotoxy(xz,yz);
        }
        if (ch=='g')
        {
            CONSOLE_CURSOR_INFO cursor_info = {1,1};
            SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
        }
        if (ch=='h')
        {
            CONSOLE_CURSOR_INFO cursor_info = {1,0};
            SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
        }
        tie=clock();
        tik=clock();
        if(ch==0x1B)
        {
            esc:;
            char get;
            system("cls");
            gotoxy(16,10);
            printf("               游戏已暂停。\n");
            gotoxy(16,13);
            printf("按“ESC”键返回游戏,按“S”键查看游戏日志,\n");
            gotoxy(16,15); 
            printf("按“G”键显示光标,按“H”键隐藏光标(此功能需在游\n");
            gotoxy(16,17);
            printf("戏界面使用)按“C”键重新加载游戏(本功能会清除您\n");
            gotoxy(16,19);
            printf("本次所有游戏数据,请谨慎使用,本游戏没有存档功能。)\n"); 
            gotoxy(16,21);
            printf("按“Shift”键加“Q”键进行崩溃测试(此功能请谨慎使用)\n");
            gotoxy(16,23);
            printf("按“B”键选取物品,如果背包异常,请尝试使用崩溃测试。\n"); 
            gotoxy(6,25);
            printf("按“S”键向下挖,按“W”键向上走,按“D”键向右挖,按“A”键向左挖。\n"); 
            gotoxy(16,27);
            printf("按“J”键在左边放置一排方块,“L”键在右边放置一排方块,\n");
            gotoxy(16,29);
            printf("“K”键在下方放置一排方块,“I”键在上方放置一排方块。\n");
            get=getch();
            if(get==0x1B)
            {
                goto loop;
            }
            if(get=='s')
            {
                tin=clock();
                system("cls");
                printf("Initialization:%d mm\n",ti);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Initialization:%d mm\n",ti);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Initialization:%d mm\n",ti);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Initialization:%d mm\n",ti);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Total running time:%d mm\n",tik);
                printf("Handle terrain:%d mm\n",tim);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Initialization:%d mm\n",ti);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Initialization:%d mm\n",ti);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Total running time:%d mm\n",tik);
                printf("Handle terrain:%d mm\n",tim);
                printf("按任意键继续...");
                getch();
                goto esc;
            }
            if (get=='c')
            {
                goto loop;
            }
            if (get=='b')
            {
                exit(0);
            } 
        }
        if (ch=='Q')
        {
            system("cls");
            gotoxy(16,15);
            printf("游戏崩溃了!");
            gotoxy(16,17); 
            printf("按“S”键查看游戏日志。");
            int s;
            s=getch();
            if (s=='s')
            {
                tin=clock();
                system("cls");
                printf("Initialization:%d mm\n",ti);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Initialization:%d mm\n",ti);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Initialization:%d mm\n",ti);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Initialization:%d mm\n",ti);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Total running time:%d mm\n",tik);
                printf("Handle terrain:%d mm\n",tim);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Initialization:%d mm\n",ti);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Initialization:%d mm\n",ti);
                printf("Handle terrain:%d mm\n",tim);
                printf("Print terrain:%d mm\n",tin);
                printf("Judgment input:%d mm\n",tie);
                printf("Total running time:%d mm\n",tik);
                printf("Total running time:%d mm\n",tik);
                printf("Handle terrain:%d mm\n",tim);
                printf("按任意键退出游戏...");
                getch();
                exit(0);
            }
        }
        if (ch=='s')
        {
            COORD coord;//屏幕上的坐标
            CONSOLE_SCREEN_BUFFER_INFO csbi;//控制台屏幕缓冲区信息
            coord.X=10;
               coord.Y=10;
            GetConsoleScreenBufferInfo(hout,&csbi);
               coord.X=csbi.dwCursorPosition.X;//得到坐标X的值
               coord.Y=csbi.dwCursorPosition.Y;//得到坐标Y的值
            xz=coord.X;
            yz=coord.Y;
            yz=yz+1;
            gotoxy(xz,yz);
            printp();
        }
    }
    getchar();
}

最后的原理我自己理解就行,各位大佬把单独的代码段附上就行,感谢各位大佬!!!

[此贴子已经被作者于2021-8-22 13:53编辑过]

搜索更多相关主题的帖子: 游戏 time input printf Total 
2021-08-22 13:00
狮子头
Rank: 2
等 级:论坛游民
帖 子:17
专家分:10
注 册:2021-5-22
收藏
得分:0 
直接附单独的代码段就行,不用把上面的代码打进去,谢谢大佬
2021-08-22 13:27
我善治鬼
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:107
专家分:181
注 册:2015-2-16
收藏
得分:14 
程序代码:

#include <stdio.h>

typedef char map[256][256];

int main()
{
    map m = { 0 };
    m[10][10] = 1;
    if (m[10][10] == 1) printf("是墙壁");
    return 0;
}

2021-08-22 18:45
狮子头
Rank: 2
等 级:论坛游民
帖 子:17
专家分:10
注 册:2021-5-22
收藏
得分:0 
谢谢大佬,问题已解决。
2021-08-23 14:21
快速回复:请教大佬做一下游戏的墙壁系统,谢谢!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.036510 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved