俄罗斯方块c语言程序报告摘要,俄罗斯方块c语言程序

俄罗斯方块c语言程序

#include

#include

#include

#include

#include

#include

#include

#ifdef __cplusplus

#define __CPPARGS ...

#else

#define __CPPARGS

#endif

#define MINBOXSIZE 23 /* 最小方块的尺寸 */

#define BGCOLOR 7 /* 背景着色 */

#define GX 200

#define GY 10

#define SJNUM 1000 /* 每当玩家打到一千分等级加一级*/

/* 按键码*/

#define VK_LEFT 0x4b00

#define VK_RIGHT 0x4d00

#define VK_DOWN 0x5000

#define VK_UP 0x4800

#define VK_HOME 0x4700

#define VK_END 0x4f00

#define VK_SPACE 0x3920

#define VK_ESC 0x011b

#define VK_ENTER 0x1c0d

/* 定义俄罗斯方块的方向(我定义他为4种)*/

#define F_DONG 0

#define F_NAN 1

#define F_XI 2

#define F_BEI 3

#define NEXTCOL 20 /* 要出的下一个方块的纵坐标*/

#define NEXTROW 12 /* 要出的下一个方块的横从标*/

#define MAXROW 14 /* 游戏屏幕大小*/

#define MAXCOL 20

#define SCCOL -16 /*游戏屏幕大显示器上的相对位置*/

#define SCROW -16

int gril[22][16]; /* 游戏屏幕坐标*/

int col=1,row=7; /* 当前方块的横纵坐标*/

int boxfx=0,boxgs=0; /* 当前寺块的形壮和方向*/

int nextboxfx=0,nextboxgs=0,maxcol=22;/*下一个方块的形壮和方向*/

int minboxcolor=6,nextminboxcolor=6;

int num=0; /*游戏分*/

int dj=0,gamedj[10]=;/* 游戏等级*/

/* 以下我用了一个3维数组来纪录方块的最初形状和方向*/

int boxstr[7][4][16]={{

,

,

,

},

{

,

,

,

},

{

,

,

,

},

{

,

,

,

},

{

,

,

,

},

{

,

,

,

},

{

,

,

,

}

};

/* 随机得到当前方块和下一个方块的形状和方向*/

void boxrad()

{

minboxcolor=nextminboxcolor;

boxgs=nextboxgs;

boxfx=nextboxfx;

srand(time(0));

nextminboxcolor=rand()%14+1;

if(nextminboxcolor==1||nextminboxcolor==7||nextminboxcolor==8)

nextminboxcolor=14;

nextboxfx=F_DONG;

srand(time(0));

nextboxgs=rand()%7;

}

/*初始化图形模试*/

void init(int gdrive,int gmode){

int errorcode;

initgraph(&gdrive,&gmode,"..\\bgi");

errorcode=graphresult();

if(errorcode!=grOk){

printf("error of: %s",grapherrormsg(errorcode));

exit(1);

}

}

void f24(int x,int y)

{

static int flag=0;

int i,j,m,k;

int n;

int a[2][66]={{0x00,0x00,0x00,0x00,0x30,0x00,

0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,

0x00,0x00,0x30,0xF0,0x04,0x30,0x78,0x0C,

0x30,0x18,0x0C,0x31,0x00,0x0C,0x31,0x80,

0x0C,0x33,0x80,0x0C,0x13,0x00,0x08,0x07,

0x00,0x00,0x06,0x00,0x00,0x0C,0x00,0x00,

0x18,0x00,0x00,0x38,0x00,0x00,0x60,0x00,

0x01,0xC0,0x00,0x03,0x80,0x00,0x0E,0x00,

0x00,0x38,0x00,0x00},

{0x01,0x80,0x00,0x03,0x80,0x00,

0x07,0x06,0x00,0x2E,0x1F,0x00,0x38,0x76,

0x00,0x33,0x66,0x1E,0x13,0x7F,0xFE,0x13,

0x76,0xC6,0x13,0x64,0xC6,0x13,0x7C,0x86,

0x17,0x60,0xBC,0x3F,0x6C,0x9C,0x33,0x6E,

0x8C,0x32,0x7E,0x80,0x06,0xF0,0x80,0x06,

0x60,0x80,0x

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值