资源描述:
《俄罗斯方块C语言代码》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、实用文档#include#include#include#include#include#ifdef__cplusplus#define__CPPARGS...#else#define__CPPARGS#endif#defineMINBOXSIZE15/*最小方块的尺寸*/#defineBGCOLOR7/*背景着色*/#defineGX200#defineGY10#defineSJNUM10000/*每当玩家打到一万分等级加
2、一级*//*按键码*/#defineVK_LEFT0x4b00#defineVK_RIGHT0x4d00#defineVK_DOWN0x5000#defineVK_UP0x4800#defineVK_HOME0x4700#defineVK_END0x4f00#defineVK_SPACE0x3920#defineVK_ESC0x011b#defineVK_ENTER0x1c0d/*定义俄罗斯方块的方向(我定义他为4种)*/#defineF_DONG0#defineF_NAN1#defineF_XI2#defineF_
3、BEI3#defineNEXTCOL20/*要出的下一个方块的纵坐标*/#defineNEXTROW12/*要出的下一个方块的横从标*/#defineMAXROW14/*游戏屏幕大小*/#defineMAXCOL20#defineSCCOL100/*游戏屏幕大显示器上的相对位置*/#defineSCROW60intgril[22][16];/*游戏屏幕坐标*/标准文案实用文档intcol=1,row=7;/*当前方块的横纵坐标*/intboxfx=0,boxgs=0;/*当前寺块的形壮和方向*/intnextboxf
4、x=0,nextboxgs=0,maxcol=22;/*下一个方块的形壮和方向*/intminboxcolor=6,nextminboxcolor=6;intnum=0;/*游戏分*/intdj=0,gamedj[10]={18,16,14,12,10,8,6,4,2,1};/*游戏等级*//*以下我用了一个3维数组来纪录方块的最初形状和方向*/intboxstr[7][4][16]={{{1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0},{0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,
5、0},{1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0},{0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0}},{{0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0},{1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0},{0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0},{1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0}},{{1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0},{1,1,1,0,1,0,0,0
6、,0,0,0,0,0,0,0,0},{1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0},{0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0}},{{1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0},{1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0},{0,1,0,0,0,1,0,0,1,1,0,0,0,0,0,0},{1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0}},{{0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0},{
7、0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0},{0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0},{0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0}},{{1,1,0,0,1,1,0,0,0,0,0,0.0,0,0,0},{1,1,0,0,1,1,0,0,0,0,0,0.0,0,0,0},{1,1,0,0,1,1,0,0,0,0,0,0.0,0,0,0},{1,1,0,0,1,1,0,0,0,0,0,0.0,0,0,0}},{标准文案实用文档{0,0,0,0,1,1
8、,1,0,0,1,0,0,0,0,0,0},{1,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0},{0,1,0,0,1,1,1,0,0,0,0,0.0,0,0,0},{0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0}}};/*随机得到当前方块和下一个方块的形状和方向*/voidboxrad(){minboxcolo