俄罗斯方块C语言代码.doc

俄罗斯方块C语言代码.doc

ID:55926449

大小:34.00 KB

页数:11页

时间:2020-06-15

俄罗斯方块C语言代码.doc_第1页
俄罗斯方块C语言代码.doc_第2页
俄罗斯方块C语言代码.doc_第3页
俄罗斯方块C语言代码.doc_第4页
俄罗斯方块C语言代码.doc_第5页
资源描述:

《俄罗斯方块C语言代码.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、#include#include#include#include#include#ifdef__cplusplus#define__CPPARGS...#else#define__CPPARGS#endif#defineMINBOXSIZE15/*最小方块的尺寸*/#defineBGCOLOR7/*背景着色*/#defineGX200#defineGY10#defineSJNUM10000/*每当玩家打到一万分等级加一级*//*按键码*/#defi

2、neVK_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_BEI3#defineNEXTCOL20/*要出的下一个

3、方块的纵坐标*/#defineNEXTROW12/*要出的下一个方块的横从标*/#defineMAXROW14/*游戏屏幕大小*/#defineMAXCOL20#defineSCCOL100/*游戏屏幕大显示器上的相对位置*/#defineSCROW60intgril[22][16];/*游戏屏幕坐标*/intcol=1,row=7;/*当前方块的横纵坐标*/intboxfx=0,boxgs=0;/*当前寺块的形壮和方向*/intnextboxfx=0,nextboxgs=0,maxcol=22;/*下一个方块的形壮和方向*/intminb

4、oxcolor=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,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,

5、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,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

6、,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},{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,

7、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,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

8、,0,0,1,0,0,0,0,0,0}}};/*随机得到当前方块和下一个方块的形状和方向*/voidboxrad(){minboxcolor=nextminboxcolor;bo

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。