C++实现推箱子游戏源代码.docx

上传人:小飞机 文档编号:3153778 上传时间:2023-03-11 格式:DOCX 页数:30 大小:42.66KB
返回 下载 相关 举报
C++实现推箱子游戏源代码.docx_第1页
第1页 / 共30页
C++实现推箱子游戏源代码.docx_第2页
第2页 / 共30页
C++实现推箱子游戏源代码.docx_第3页
第3页 / 共30页
C++实现推箱子游戏源代码.docx_第4页
第4页 / 共30页
C++实现推箱子游戏源代码.docx_第5页
第5页 / 共30页
亲,该文档总共30页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《C++实现推箱子游戏源代码.docx》由会员分享,可在线阅读,更多相关《C++实现推箱子游戏源代码.docx(30页珍藏版)》请在三一办公上搜索。

1、C+实现推箱子游戏源代码#define qiang 1 #define ren 2 #define xiangzi 3 #define jia 6 #define men 8 #define space 9 int map1317 = 0; int fuben1317; int num_guan; /现在的关数 int num_xiangzi; /箱子的个数 int move_num = 0; /人行走的次数 int push_num = 0; /人推箱子的次数 int people2; /M0 是人所在位置的横坐标M1是人所在位置的纵坐标 int door2; /门所在的坐标 int tem

2、 = 0; int cc; void play; void chushi2; void guan1;void guan2;void guan3;void guan4;void guan5;void guan6; void guan7;void guan8;void guan9;void guan10;void guan11;void guan12; void guan13;void guan14; void dayin; int control; int finish; /*主方法*/ int main void jiemian; void shuoming; void xuanguan; v

3、oid chushi(int nn); void chushi1; int i; char c; chushi1; for(i = 0;i1 开始游戏nn); printf( 2 nn); printf( 3 nn); printf( 4 nn); void chushi1 int i,j; for(i = 0;i=12;i+) for (j = 0;j=16;j+) fubenij = 0; void chushi2 选择关卡游戏帮助退出游戏 int i,j;move_num = 0; push_num=0; for(i = 0;i=12;i+) for(j = 0;j=16;j+) map

4、ij = 0; fubenij = 0; /*游戏规则及说明*/ void shuoming int i; char c; for(i = 0;i=999;i+) system(cls); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); printf(tttn); printf(ttt 游戏规则及说明 n); printf(tttnn ); SetConsoleTextAttrib

5、ute(GetStdHandle(STD_OUTPUT_HANDLE),BACKGROUND_INTENSITY|FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE|FOREGROUND_RED|FOREGROUND_RED); printf(囧);SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_B

6、LUE);printf( ); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); printf(别看了,这就是你了,还挺cool的吧,嘿嘿nnn); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY | FOREGROUND_INTENSITY); printf( ); SetCo

7、nsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); printf(这个是墙,放心,不是豆腐渣工程,要不你可以去撞撞看,n); printf( 你会懂得.nnn); printf( ); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_RED | FOREGROUND_

8、GREEN | FOREGROUND_BLUE); printf(这个是箱子,就是要你去推的那个,不要试图一下推两个箱n); printf( 子,更不要想推着箱子把墙撞开,没用的.不要沮丧,再免n); printf( 费给你一句忠告,要是把箱子推到了死角,呵呵,直接下一n); printf( 关吧nnn); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY |FOREGROUND_GREEN | FOREGROUND_RED); printf( ); SetConsoleTextAttrib

9、ute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); printf(这里就是箱子们的最终归宿了,箱子要是回不到家,哼哼,n); printf( 你自己掂量着办吧。另外,只有他们都接到了自己的小箱子,n); printf( 你才能找到出口哦nnn); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY | FOREGROUND_

10、GREEN); printf( ); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); printf(箱子到家后就会变身啦nnn); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_BLUE | FOREGROUND_RED); printf( ); SetConsoleTextAttribute(

11、GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); printf(这就是你完成本关的见证了,走进去,紧接着下一关又来了nnn); printf( Ctrl+V 呵呵,很遗憾,快重新开始吧nnn); printf( Ctrl+C 这个是退出的哦,按了就什么都没有了nnn); printf( 按这个控制方向就可以了,开推吧那就nnnnnnt ); SetConsoleTextAttribute(GetStdHandle(STD_OUTP

12、UT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED | FOREGROUND_GREEN); cout返回请按Bendl; c = getche; if(c = B|c = b) system(cls); return; else continue; void xuanguan int c; int i,gg = 1,j = 0,k; for(i = 0;i=999;i+) system(cls); tem = 0; printf(nn); printf( n); printf( 1 2 3 4 5 6n); printf( nn); printf(

13、n); printf( 7 8 9 n); printf( nn); printf( n); printf( n); printf( nn); printf(nn 请选择关卡: ); fflush(stdin); scanf(%d,&c); system(cls); for(k = c;k=30;k+) tem = 0; system(cls); if(k = 1) guan1; else if(k = 2) guan2; else if(k = 3) guan3; else if(k = 4) guan4; else if(k = 5) guan5; else if(k = 6) guan6

14、; else if(k = 7) guan7; else if(k = 8) guan8; else if(k = 9) guan9; else if(k = 10) guan10; else if(k = 11) guan11; else if(k = 12) guan12; else if(k = 13) guan13; else if(k = 14) guan14; j = control; if(j = 1) system(cls); return ; void play int i,gg = 1,j = 0; for(i = 1;i= 2&command = 26) if(comma

15、nd=3) return 1; else ; /Ctrl+az:126 if(win = finish = 0) tem=0; system(cls); dayin; if(win = finish) = 1&mapdoor0door1 = ren) Sleep(225); return 0; return 0; /*关卡初始化区域*/ void guan1 int i,j; chushi2; num_guan = 1; move_num = 0; push_num = 0; num_xiangzi = 1; for(i=0;i=12;i+) for(j=0;j=16;j+) mapij =

16、0; fubenij = 0; for(i=3;i=14;i+) map3i=1; map11i=1; for(i=4;i=10;i+) mapi3=1; mapi14=1; map76 = ren; people0 = 7; people1 = 6; fuben710 = jia; map78 = xiangzi; map710 = jia; fuben511 = men; door0 = 5; door1 = 11; dayin; void guan2 int i; chushi2; num_guan = 2; num_xiangzi = 2; for(i = 4;i=13;i+) map2i = 1; for(i = 3;i=11;i+) mapi4 = 1; for(i = 4;i=9;i+) map11i = 1; for(i = 8;i=11;i+) mapi9 = 1; for(i = 9;i=13;i+) map8i = 1; for(i = 2;i=8;i+) mapi13 = 1; map97 = ren; people0 = 9;

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号