该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
玩过炸弹超人吧,玩过qq堂吧,制作这些很适合我这个初c学者,我学习c语言也近2个月了,就随手编了个游戏,用了2天啊~~~
两个人碗的,A控制WASD空格,B控制光标键和回车
命数,关的风格自己在文件头自己搞定;可以吃的道具由种分别加威力和雷数(最多8个)--简单的16色游戏。
没有注解,看完后,给点建议---------------badming————————————
/* WIN-TC BGI 图形编程模板 */
#include "Conio.h"
#include "graphics.h"
#include
#include
#define closegr closegraph
#define UP 0x4800
#define DOWN 0x5000
#define LEFT 0x4b00
#define RIGHT 0x4d00
#define SPACE 0x3920
#define W 0x1177
#define S 0x1f73
#define A 0x1e61
#define D 0x2064
#define ENTER 0x1c0d
#define ESC 0x011b
int a[13][19]={
{10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10},
{0,1,1,10,2,10,10,104,103,102,101,10,10,10,10,10,10,10,10},
{0,1,10,12,10,10,102,102,103,103,103,10,10,10,10,10,10,10,10},
{0,10,10,10,10,120,120,12,12,103,103,13,130,130,10,10,10,10,10},
{0,10,10,10,10,120,1204,102,102,103,103,130,130,130,10,10,10,10,10},
{0,10,10,10,10,120,1204,102,102,103,103,130,130,130,10,10,10,10,10},
{0,10,10,10,10,1204,1204,102,102,13,130,130,130,130,10,10,10,10,10},
{0,10,10,10,10,120,1204,120,102,103,130,130,130,130,10,10,10,10,10},
{0,10,10,10,10,120,1204,120,102,104,140,140,10,10,10,103,10,10,10},
{0,10,10,10,10,140,14,14,14,140,104,140,10,10,103,10,104,104,104},
{0,10,10,10,10,140,14,14,14,140,104,140,10,104,10,104,10,104,10},
{0,10,10,10,10,140,14,14,14,140,104,140,10,10,102,102,102,10,1},
{0,10,10,10,10,140,144,1440,1400,104,140,140,10,10,10,10,4,1,1}};
int a1=1,b1=1,mov1=1,high1=1,wide1=1,num1=1,lnum1=1,life1=100;
int a2=18,b2=12,mov2=1,high2=1,wide2=1,num2=1,lnum2=1,life2=10;
struct po{int x;int y;int lmax;int rmax;int umax;int dmax;
int feel;long time;struct po *next;};
struct po po1,po2,po3,po4,po5,po6,po7,po8,po9,po10,po11,po12,po13,po14,po15,po16,*p1,*p2;
f(x,y)
{int z;
if(a[y][x]<10)z=a[y][x];else z=a[y][x]/10;
return z;}
g(x,y)
{int z;
z=a[y][x]%10;
return z;
}
void initgr(void) /* BGI初始化 */
{
int gd = DETECT, gm = 0; /* 和gd = VGA,gm = VGAHI是同样效果 */
registerbgidriver(EGAVGA_driver);/* 注册BGI驱动后可以不需要.BGI文件的支持运行 */
initgraph(&gd, &gm, "");
}
draw0(x,y)
{setfillstyle(1,14);bar(30*x+20,30*y+30,30*x+50,30*y+60);}
draw1(x,y)
{setcolor(BLUE);setfillstyle(1,GREEN);bar(30*x+20,30*y+30,30*x+50,30*y+60);}
draw2(x,y)
{setcolor(RED);line(30*x+35,30*y+30,30*x+35,30*y+60);
line(30*x+20,30*y+45,30*x+35,30*y+30);line(30*x+35,30*y+30,30*x+50,30*y+45);}
draw3(x,y)
{setcolor(RED);line(30*x+20,30*y+45,30*x+50,30*y+45);
line(30*x+35,30*y+30,30*x+50,30*y+45);line(30*x+50,30*y+45,30*x+35,30*y+60);}
draw4(x,y)
{setcolor(9);line(30*x+20,30*y+45,30*x+50,30*y+45);
line(30*x,30*y+15,30*x+30,30*y+15);circle(30*x+35,30*y+45,15);}
draw5(x,y)
{setcolor(0);setfillstyle(1,0);pieslice(30*x+35,30*y+45,0,360,15);}
draw6(x,y)
{setcolor(RED);setfillstyle(1,13);bar(30*x+20,30*y+30,30*x+50,30*y+60);}
draw7(x,y)
{setcolor(RED);circle(30*x+35,30*y+40,10);
line(30*x+35,30*y+50,30*x+35,30*y+60);line(30*x+35,30*y+50,30*x+40,30*y+60);}