基于arm的捡星星游戏.docx

上传人:小飞机 文档编号:3384898 上传时间:2023-03-12 格式:DOCX 页数:6 大小:37.46KB
返回 下载 相关 举报
基于arm的捡星星游戏.docx_第1页
第1页 / 共6页
基于arm的捡星星游戏.docx_第2页
第2页 / 共6页
基于arm的捡星星游戏.docx_第3页
第3页 / 共6页
基于arm的捡星星游戏.docx_第4页
第4页 / 共6页
基于arm的捡星星游戏.docx_第5页
第5页 / 共6页
亲,该文档总共6页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《基于arm的捡星星游戏.docx》由会员分享,可在线阅读,更多相关《基于arm的捡星星游戏.docx(6页珍藏版)》请在三一办公上搜索。

1、基于arm的捡星星游戏#include bspcpudef.h #include bspuartuart.h #include bspcpu44blib.h #include bspadad.h #include bsplcdlcdchar.h #include bsplcdlcd.h #include bspinit.h / S32 StarX,StarY,DiscX,DiscY; S32 Star_state; /delay S32 deleyTime=5000,speed=5000; / S32 accelate_star = 0; /socre S32 currentscore=0,x

2、=0,level=0; void Create_Star(void); void Display_Disc(void); void Pick_Star(void); void Drop_Start(void); void Display_Score(void); void Display_Disc(void); void Beep_Play(U8 sound); void Pick_Star(void); void Pause_Game(void); void Display_Message(void); void Main(void) Bsp_Init; DiscX=120; DiscY=2

3、20; Lcd_Clr; Display_Message; Display_Score; while(1) Create_Star; Drop_Start; Display_Score; Delay(5000); void Create_Star(void) accelate_star = 0; Star_state= (int)(rand%2); StarX=(int)(rand%200); StarY =16; gotoxy(StarX,StarY); if(Star_state) LCD_Printf(*); else LCD_Printf(0); / Star Drop control

4、 function void Drop_Start(void) U8 i; for(i=32;i-); Pick_Star;/receive star void Display_Score(void) gotoxy(220,16); LCD_Printf(Score: %d,currentscore); gotoxy(220,32); LCD_Printf(Level: %d,level); void Display_Disc(void) U8 current_key; current_key=getKey; switch(current_key) case 56: accelate_star

5、 = 1; break; case 50: case 54: DiscX+=32; break; case 51: DiscX=0; break; DiscX =200; break; case 55: DiscX-=32; break; case 58: DiscX+=16; break; DiscX-=16; break; Pause_Game; break; case 59: case 60: if(DiscX190) DiscX=190; gotoxy(DiscX,DiscY); LCD_Printf(-); clearKey; void Pick_Star(void) if(Star

6、XDiscX-10) if(Star_state) currentscore += 10; else currentscore -= 10; Beep_Play(1); Beep_Play(2); if(int)(currentscore/30) != level) Beep_Play(6); level = currentscore/30; if(deleyTime = 100) deleyTime -=100; void Pause_Game(void) void Display_Message(void)/display the detial message gotoxy(230,185

7、); LCD_Printf(接星星!); gotoxy(230,205); /draw the frame Lcd_Draw_HLine (0, 320, 0, BLACK, 2); Lcd_Draw_HLine (0, 320, 238,BLACK , 2); Lcd_Draw_VLine (0, 240, 0, BLACK, 2); Lcd_Draw_VLine (0, 240, 318, BLACK, 2); Lcd_Draw_VLine (0, 240, 219, BLACK, 2); U8 current_key; x=1; / repeat draw basic message L

8、cd_Clr; Display_Message; Display_Score; gotoxy(DiscX,DiscY); LCD_Printf(-); gotoxy(StarX,StarY); LCD_Printf(*); gotoxy(221,223); LCD_Printf(Pause); /get current ket_value current_key=getKey; while(current_key!=61) clearKey; current_key=getKey; x=0; gotoxy(221,223); LCD_Printf(Running); clearKey; LCD

9、_Printf(lyung); gotoxy(221,48); LCD_Printf(S51:head); gotoxy(221,64); gotoxy(221,80); LCD_Printf(S56:Acl star); gotoxy(221,96); LCD_Printf(S55:Left); gotoxy(221,112); LCD_Printf(S50:tail); LCD_Printf(S54:+Right); gotoxy(221,128); LCD_Printf(S59:Left); gotoxy(221,144); LCD_Printf(S58:Right); gotoxy(221,160); LCD_Printf(S60:Pause); LCD_Printf(S61:Run); if(x=0) gotoxy(221,223); LCD_Printf(Running); gotoxy(221,176); void Beep_Play(U8 sound) U8 i; U32 s; s=sound*100; for(i=0;i10;i+) Beep(1); Led_Display(5); Delay(s); Beep(0); Led_Display(10); Delay(s); Led_Display(0);

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号