一个C语言编写的推箱子游戏 |
|
|
|
/* 一个C语言编写的推箱子游戏源代码 */ /* 本游戏是字符模式的,请不要在中文dos下运行。本游戏在TURBO C下调试通过 */ #include <dos.h> #include <stdio.h> #include <ctype.h> #include <conio.h> #include <bios.h> #include <alloc.h>
/* 定义二维数组ghouse来记录屏幕上各点的状态, 其中:0表示什么都没有,'b'表示箱子,'w'表示墙壁,'m'表示目的地,'i'表示箱子在目的地。 */ char ghouse[20][20];
/* 以下函数为直接写屏函数,很酷的函数哦!是我朋友告诉我的。 */ char far *screen=(char far* )0xb8000000; void putchxy(int y,int x,char ch,char fc,char bc) { screen[(x*160)+(y<<1)+0]=ch; screen[(x*160)+(y<<1)+1]=(bc*16)+fc; }
/* 定义判断是否胜利的数据结构 */ typedef struct winer { int x,y; struct winer *p; }winer;
/* 箱子位置的数据结构 */ typedef struct boxs { int x,y; struct boxs *next; }boxs;
/* 在特定的坐标上画墙壁并用数
< 1 > < 2 > |
|
|
在百度搜索:一个C语言编写的推箱子游戏
|