挡板球(小游戏)

上传人:小** 文档编号:29667333 上传时间:2021-10-08 格式:DOC 页数:5 大小:67KB
返回 下载 相关 举报
挡板球(小游戏)_第1页
第1页 / 共5页
挡板球(小游戏)_第2页
第2页 / 共5页
挡板球(小游戏)_第3页
第3页 / 共5页
点击查看更多>>
资源描述
#include#include#include#include#include#include#include#include#define LEFT 0x4b00#define RIGHT 0x4d00#define ESC 0x11b#define Enter 0x1c0dunsigned long int flag1110=0,score=0;enum spd s1=10, s2=8,s3=6,s4=4,s5=2,s6=0gamespeed;void chose()int i; textmode(2);printf(nnnnPlease Input The Speed You Want(from 1 to 6):);scanf(%d,&i);switch(i) case 1: gamespeed=s1;printf(ThankYou!WishYouHaveAHappyDay);for(;!kbhit();); break;case 2: gamespeed=s2;printf(ThankYou!WishYouHaveAHappyDay);for(;!kbhit();); break;case 3: gamespeed=s3;printf(ThankYou!WishYouHaveAHappyDay);for(;!kbhit();); break;case 4: gamespeed=s4;printf(ThankYou!WishYouHaveAHappyDay);for(;!kbhit();); break;case 5: gamespeed=s5;printf(ThankYou!WishYouHaveAHappyDay);for(;!kbhit();); break;case 6: gamespeed=s6;printf(ThankYou!WishYouHaveAHappyDay);for(;!kbhit();); break;default: printf( Oh! My God! Please Check The Number! Is it bewtten 1 and 6 ?);for(;!kbhit(););exit(0); int init() auto int gdriver=DETECT,gmode,i,j;/* registerbgifont(); */ registerbgidriver(EGAVGA_driver);initgraph(&gdriver,&gmode,E:tcppbgi); setbkcolor(9);setcolor(5);setlinestyle(0,0,3);for(i=0;i=10;i+) int c=i;if(c=9)c=3;for(j=0;j=9;j+) setfillstyle(1,c);c+;if(c=9)c=6; rectangle(j*60+15,20*i,60*j+75,20*i+20),flagij=1;floodfill(j*60+20,20*i+10,5);setfillstyle(1,15);floodfill(20,10,5);floodfill(380,210,5);setlinestyle(0,0,1);setfillstyle(1,BLUE);rectangle(50,460,110,480);floodfill(60,470,5); return 0;int daba() static int x=50;if(!kbhit()return 0;elseint key;key=bioskey(0);switch(key) case LEFT:setfillstyle(1,9);floodfill(x+10,470,5);setcolor(9);rectangle(x,460,x+60,480); setcolor(5);setfillstyle(1,BLUE);if(x=579)rectangle(579,460,639,480);floodfill(600,470,5);x=579;elserectangle(x+10,46 0,x+70,480);floodfill(x+30,470,5);x+=10; return 1;case ESC: return 2;default: return 0;return 0;int Juge(int &direction,int x,int y)int i,j,k;if(y=240) return 0;switch(direction) case 1: for(k=0;k=3;k+);i=k;if(i=11)return 0;for(k=0;k=60*k-5&x=1&flagij-1!=0)rectangle(60*j+15-60,20*i,60*j+15,20*i+20);if(j=0&flagij+1!=0) rectangle(15,20*i,75,20*i+20);if(j=9&flagij-1!=0)rectangle(60*9+15,20*i,60*9+75,20*i+2 0);if(j=1&flagi-1j!=0)rectangle(60*j+15,20*i-20,60*j+75,20*i);flagij=0;direction=-2;return 1; else if(flagij-1=0)return 0;else if(x=60*j+15+8)return 0;elsedirection=-2;return 1;case 2: for(k=0;k=3;k+);i=k;if(i=11)return 0;for(k=0;k=60*k-5&x=1&flagij-1!=0)rectangle(60*j+15-60,20*i,60*j+15,20*i+20);if(j=1&flagi-1j!=0)rectangl e(60*j+15,20*i-20,60*j+75,20*i); return 1; else if(flagij+1=0)return 0;else if(x=60*j+15-8)return 0;elsedirection=-1;return 1;case -1:for(k=2;k=2;k+);i=k;if(i=11)return 0;for(k=0;k=60*k-5&x=1&flagij-1!=0)rectangle(60*j+15-60,20*i,60*j+15,20*i+20);if(j=0&flagij+1!=0) rectangle(15,20*i,75,20*i+20);if(j=9&flagij-1!=0)rectangle(60*9+15,20*i,60*9+75,20*i+2 0);if(j=8&flagij+1!=0)rectangle(60*j+75,20*i,60*j+75+60,20*i+20);if(i=8&flagi+1j !=0)rectangle(60*j+15,20*i-20,60*j+75,20*i); flagij=0;direction=2;return 1; else if(flagij+1=0&flagij-1=0)return 0;else if(x=60*i+15-68)return 0;else direction=2;return 1;case -2:for(k=2;k=2;k+);i=k;if(i=11)return 0;for(k=0;k=60*k-5&x=1&flagij-1!=0)rectangle(60*j+15-60,20*i,60*j+15,20*i+20);if(j=0&flagij+1!=0) rectangle(15,20*i,75,20*i+20);if(j=9&flagij-1!=0)rectangle(60*9+15,20*i,60*9+75,20*i+2 0);if(j=8&flagij+1!=0)rectangle(60*j+75,20*i,60*j+75+60,20*i+20);if(i=8&flagi+1j !=0)rectangle(60*j+15,20*i-20,60*j+75,20*i); flagij=0;direction=2;return 1; else if(flagij+1=0&flagij-1=0)return 0;else if(x=21&x0=21;x0-,y0-) if(kbhit()goto loop;delay(gamespeed);if(Juge(direction,x0,y0)!=0)goto swi; putimage(x0-22,y0-22,buf1,0);x0+,y0+;if(x0=21)direction=2;else direction=-2;break;case 2:for(;x0=21;x0+,y0-) if(kbhit()goto loop;delay(gamespeed);if(Juge(direction,x0,y0)!=0)goto swi; putimage(x0-22,y0-22,buf1,0);x0-,y0+;if(x0=617)direction=1;else direction=-1; break;case -1:for(;x0=617&y0=x&x0-20=x+60)direction=2;elsefor(;y0=21&y0=x&x0-20=x+60) direction=1;else for(;y0=500;y0+,x0-)delay(gamespeed);putimage(x0-22,y0-22,buf1,0);return 0; else direction=-1; break;loop: key=bioskey(0);switch(key) case LEFT:setfillstyle(1,9);floodfill(x+10,470,5);setcolor(9);rectangle(x,460,x+60,480);bar(x,460,x+60 ,480);setcolor(5);setfillstyle(1,BLUE); if(x=579)sprintf(s,%d,score);outtextxy(589,470,s);rectangle(579,460,639,480);floodfill(600,470,5);x=579;elsesprintf(s,%d,score);outtextxy(x+2 0,470,s);rectangle(x+10,460,x+70,480);floodfill(x+30,470,5);x+=10; break;case ESC: break;default: break;if(key=ESC)break;return 0;int main() chose();init();play();getch(); closegraph();return 0;
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 解决方案


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!