ImageVerifierCode 换一换
格式:DOCX , 页数:17 ,大小:18.30KB ,
资源ID:21791499      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/21791499.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(北邮 俄罗斯方块 C++程序代码文档格式.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

北邮 俄罗斯方块 C++程序代码文档格式.docx

1、/挑战模式void Block_Score();/储存分数HANDLE handle;WORD Colors1=FOREGROUND_RED;WORD BColors1=FOREGROUND_BLUE;WORD GColors1=FOREGROUND_GREEN;/设置颜色int block_cshape44,block_newshape44;/设置两个临时方块矩阵int speed=1,delay_max=100,delay,score=0,score_high,mode;/设置速度,最大延迟,延迟,分数,最高分,模式int map_shape2446;/设置地图矩阵int x_coordi

2、nate=29, y_coordinate=3;/初始横纵坐标int block_shape744=0,0,0,0, 1,1,1,1, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, 0,1,1,1, 0,1,1,0, 0,1,0,0, 0,1,1,0, 0,1,1,0, 0,0,1,0, 0,0,0,0, 0,0,1,1, 1,1,0,0, 0,0,0,0;/设置种方块void main()/主函数 handle = initiate();/屏幕初始化 srand(time(NULL); textout(handle,20,7,Colors,1,); Sleep(30

3、0); textout(handle,22,7,Colors,1, textout(handle,24,7,Colors,1, textout(handle,26,7,Colors,1, textout(handle,28,7,Colors,1, textout(handle,30,7,Colors,1, textout(handle,34,7,Colors,1, textout(handle,36,7,Colors,1, textout(handle,40,7,Colors,1, textout(handle,42,7,Colors,1, textout(handle,44,7,Colors

4、,1, textout(handle,20,11,Colors,1,Please select game mode: textout(handle,22,12,Colors,1,Press n to choosen normal mode textout(handle,22,13,Colors,1,c to choosen challenge mode int ktemp = _getch(); switch(ktemp) case 110: Start(); Begin_normal(); break; case 99: Begin_challenge(); default: PlaySou

5、nd( E:BUPT小学期c+俄罗斯方块standard俄罗斯方块kaitou.wav,0,SND_ASYNC); while(1) x_coordinate = 29, y_coordinate = 3; Block_Birth(); while(1)/一个方块下落整个过程 delay = 0; while(delaydelay_max) if (_kbhit() Block_Change(block_cshape); Sleep(8); delay+; /判断对方块的操作 if(Block_Available(block_cshape,0,1) Block_Clear(block_csha

6、pe); y_coordinate+; Block_Print(block_cshape); /判断是否下移 else Block_Intomap(block_cshape); Block_Deleteline(); break; /判断是否消行 void Start() textout(handle,50,15,BColors,1,Instruction: textout(handle,50,16,BColors,1,Please control by textout(handle,50,17,BColors,1,the textout(handle,50,18,BColors,1,Esc

7、to exit textout(handle,20,2,GColors,1,O textout(handle,20,23,GColors,1, textout(handle,45,2,GColors,1, textout(handle,45,23,GColors,1, textout(handle,50,23,BColors,1,Manufactured by LRJ in BUPT textout(handle,50,5,BColors,1,Score: textout(handle,50,3,BColors,1,Speed: char output10;/临时输出矩阵 itoa(score

8、,output,10); textout(handle,56,5,BColors,1,output); itoa(speed,output,10); textout(handle,56,3,BColors,1,output); for(int x=21;x45;x+) textout(handle,x, 2,GColors,1,= textout(handle,x, 23,GColors,1, for(int y=3;youtput;score_high; readfile.close(); textout(handle,50,6,BColors,1,Best: textout(handle,

9、56,6,BColors,1,output); /读取最高分void Begin_challenge() mode = 1; textout(handle,26,1,BColors,1,Challenge Mode int line; textout(handle,23,10,Colors,1,Please input initial textout(handle,23,11,Colors,1,blocks lines and textout(handle,23,12,Colors,1,then press Enter cinline; textout(handle,0,0,Colors,1,

10、 for(int x=22;x22-line;x-)y+=2) int n = rand()%2; map_shapexy = n; if(n) textout(handle,y,x,Colors,1, Sleep(70); /初始化地图矩阵BUPT小学期c+俄罗斯方块standard俄罗斯方块score_challenge.txtvoid Block_Print(int block_shape44)/打印方块函数4; if (block_shapexy=1) textout(handle,x_coordinate+2*y, y_coordinate+x,Colors,1,void Block

11、_Clear(int block_shape44)/擦除方块 for(int y=0; for(int x=0; if (block_shapeyx=1) textout(handle,x_coordinate+2*x,y_coordinate+y,Colors,1,void Block_Change(int block_shape44)/操作方块 int direction = _getch(); switch(direction) case 72:/up 方块变形 for(int k=0;kk+) for(int j=0;jj+) block_newshape3-jk = block_sh

12、apekj; if(Block_Available(block_newshape,0,0) Block_Clear(block_cshape); Block_Print(block_newshape); for(int k=0; for(int j=0; block_cshapekj = block_newshapekj; break; case 75:/left 方块左移 if(Block_Available(block_cshape,-2,0) x_coordinate-=2; Block_Print(block_cshape); case 77:/right 方块右移 if(Block_

13、Available(block_cshape,2,0) x_coordinate+=2; case 80:/down 方块下移 delay=delay_max; case 27:/Esc 推出暂停游戏 textout(handle,50,10,Colors,1,Do u want to exit textout(handle,50,11,Colors,1,the game(y/n) int temp = _getch(); switch(temp) case 121: textout(handle,50,10,Colors,1, textout(handle,50,11,Colors,1, t

14、extout(handle,34,11,BColors,1,score: char output10; itoa(score,output,10); textout(handle,40,11,BColors,1,output); PlaySound( BUPT小学期c+俄罗斯方块standard俄罗斯方块dead.wav,0,0); Block_Score();input error.if u want to exit, textout(handle,50,12,Colors,1,please press Esc again Sleep(1000);void Block_Intomap(int

15、 block_shape44)/更改地图矩阵 switch(y) case 0: map_shapey_coordinate+xx_coordinate+y=block_shapexy; break; case 1: case 2: case 3: map_shapey_coordinate+xx_coordinate+2*y=block_shapexy; Block_Print(block_shape);bool Block_Available(int block_shape44,int x_move,int y_move)/判断方块能否放下 for(int y=0; if (block_s

16、hapexy=1) switch(y) case 0: if (map_shapey_coordinate+y_move+xx_coordinate+x_move+y&block_shapexy) return 0; break; case 1: case 2: case 3: if (map_shapey_coordinate+y_move+xx_coordinate+x_move+2*y& return 1;void Block_Birth()/方块生成 int n = rand()%7; for(int k=0; for(int j=0; block_cshapekj=block_sha

17、penkj; block_newshapekj=block_shapenkj; /随机生成方块 if(!Block_Available(block_cshape,0,0)/判断游戏是否结束 PlaySound( textout(handle,24,10,BColors,1, Sleep(300); textout(handle,26,10,BColors,1, textout(handle,28,10,BColors,1, textout(handle,30,10,BColors,1, textout(handle,34,10,BColors,1, textout(handle,36,10,BColors,1, textout(handle,38,10,BColors,1, textout(handle,40,10,BColors,1,

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1