源代码---推箱子游戏.doc

上传人:博****1 文档编号:545037662 上传时间:2024-01-21 格式:DOC 页数:19 大小:50KB
返回 下载 相关 举报
源代码---推箱子游戏.doc_第1页
第1页 / 共19页
源代码---推箱子游戏.doc_第2页
第2页 / 共19页
源代码---推箱子游戏.doc_第3页
第3页 / 共19页
源代码---推箱子游戏.doc_第4页
第4页 / 共19页
源代码---推箱子游戏.doc_第5页
第5页 / 共19页
点击查看更多>>
资源描述

《源代码---推箱子游戏.doc》由会员分享,可在线阅读,更多相关《源代码---推箱子游戏.doc(19页珍藏版)》请在金锄头文库上搜索。

1、/* turbo c 2.0 turbo c 2.0 c turbo c 2.0 */#include #include #include #include #include #include typedef struct winer int x,y; struct winer *p; winer; char status 2020; char far *printScreen=(char far* )0xB8000000; void putoutChar(int y,int x,char ch,char fc,char bc);void printWall(int x, int y);voi

2、d printBox(int x, int y);void printBoxDes(int x, int y);void printDestination(int x, int y);void printDestination1(int x,int y,winer *win,winer *pw);void printMan(int x, int y);void init();winer *initStep1();winer *initStep2();winer *initStep3();winer *initStep4();void moveBoxSpacetoSpace(int x ,int

3、 y, char a);void moveBoxDestoSpace(int x ,int y, char a) ;void moveBoxSpacetoDes(int x, int y, char a);void moveBoxDestoDes(int x, int y, char a);int judge(int x, int y);void move(int x, int y, char a);void reset(int i);void putoutChar(int y,int x,char ch,char fc,char bc) printScreen(x*160)+(y1)+0=c

4、h; printScreen(x*160)+(yx=x; (*pw)-y=y; (*pw)-p=NULL; else qw=(winer* )malloc(sizeof(winer); qw-x=x; qw-y=y; (*pw)-p=qw; (*pw)=qw;qw-p=NULL; void printDestination(int x,int y) putoutChar(y-1,x-1,003,YELLOW,BLACK); statusxy=m; void printMan(int x,int y) gotoxy(y,x); _AL=02; _CX=01; _AH=0xa; geninterr

5、upt(0x10); void printBoxDes(int x,int y) putoutChar(y-1,x-1,10,YELLOW,BLACK); statusxy=i; void init() int i,j; for(i=0;i20;i+) for(j=0;j20;j+) statusij=0; _AL=3; _AH=0; geninterrupt(0x10); gotoxy(40,4); printf(Welcome to the box world!); gotoxy(40,6); printf(You can use up, down, left,); gotoxy(40,8

6、); printf(right key to control it, or); gotoxy(40,10); printf(you can press Esc to quit it.); gotoxy(40,12); printf(Press space to reset the game.); gotoxy(40,14); printf(Wish you have a good time !); gotoxy(40,16); printf(April , 2007); winer *initStep1() int x; int y; winer *win=NULL; winer *pw; f

7、or(x=1,y=5;y=9;y+) printWall(x+4,y+10); for(y=5,x=2;x=5;x+) printWall(x+4,y+10); for(y=9,x=2;x=5;x+) printWall(x+4,y+10); for(y=1,x=3;x=8;x+) printWall(x+4,y+10); for(x=3,y=3;x=5;x+) printWall(x+4,y+10); for(x=5,y=8;x=9;x+) printWall(x+4,y+10); for(x=7,y=4;x=9;x+) printWall(x+4,y+10); for(x=9,y=5;y=

8、7;y+) printWall(x+4,y+10); for(x=8,y=2;y=3;y+) printWall(x+4,y+10); printWall(5+4,4+10); printWall(5+4,7+10); printWall(3+4,2+10); printBox(3+4,6+10); printBox(3+4,7+10); printBox(4+4,7+10); printDestination1(4+4,2+10,&win,&pw); printDestination1(5+4,2+10,&win,&pw); printDestination1(6+4,2+10,&win,&

9、pw); printMan(2+4,8+10); return win; winer *initStep2() int x; int y; winer *win=NULL; winer *pw; for(x=1,y=4;y=7;y+) printWall(x+4,y+10); for(x=2,y=2;y=4;y+) printWall(x+4,y+10); for(x=2,y=7;x=4;x+) printWall(x+4,y+10); for(x=4,y=1;x=8;x+) printWall(x+4,y+10); for(x=8,y=2;y=8;y+) printWall(x+4,y+10

10、); for(x=4,y=8;x=8;x+) printWall(x+4,y+10); for(x=4,y=6;x=5;x+) printWall(x+4,y+10); for(x=3,y=2;x=4;x+) printWall(x+4,y+10); for(x=4,y=4;x=5;x+) printWall(x+4,y+10); printWall(6+4,3+10); printBox(3+4,5+10); printBox(6+4,6+10); printBox(7+4,3+10); printDestination1(5+4,7+10,&win,&pw); printDestination1(6+4,7+10,&win,&pw); printDestination1(7+4,7+10,&win,&pw); printMan(2+4,6+10); return win; winer *initStep3() int x; int y; winer *win=NULL; winer *pw; for(x=1,y=2;y=8;y+) printWall(x+4,y+10); for(x=2,y=2;x=4;x+) printWall(x+4,y+10); for(x=4,y=1;y=3;y+) printWall(x+4,y+10);

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号