资源描述:
《挡板球(小游戏).doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、#include#include#include#include#include#include#include#include#defineLEFT0x4b00#defineRIGHT0x4d00#defineESC0x11b#defineEnter0x1c0dunsignedlongintflag[11][10]={0},score=0;enumspd{s1=10,s2=8,s3=6,s4=4,s5=2,s6=0}gamespeed;vo
2、idchose(){inti;textmode(2);printf("PleaseInputTheSpeedYouWant(from1to6):");scanf("%d",&i);switch(i){case1:gamespeed=s1;printf("ThankYou!!WishYouHaveAHappyDay");for(;!kbhit(););break;case2:gamespeed=s2;printf("ThankYou!!WishYouHaveAHappyDay");for(;!kbhit(););break;case3:gamespeed=s3;print
3、f("ThankYou!!WishYouHaveAHappyDay");for(;!kbhit(););break;case4:gamespeed=s4;printf("ThankYou!!WishYouHaveAHappyDay");for(;!kbhit(););break;case5:gamespeed=s5;printf("ThankYou!!WishYouHaveAHappyDay");for(;!kbhit(););break;case6:gamespeed=s6;printf("ThankYou!!WishYouHaveAHappyDay");for(;!kbhit();
4、);break;default:printf("Oh!!MyGod!PleaseCheckTheNumber!Isitbewtten1and6??");for(;!kbhit(););exit(0);}}intinit(){autointgdriver=DETECT,gmode,i,j;/*registerbgifont();*/registerbgidriver(EGAVGA_driver);initgraph(&gdriver,&gmode,"E:\tcpp\bgi");setbkcolor(9);setcolor(5);setlinestyle(0,0,3);for(i=0;
5、i<=10;i++){intc=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),flag[i][j]=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);floo
6、dfill(60,470,5);return0;}intdaba(){staticintx=50;if(!kbhit())return0;else{intkey;key=bioskey(0);switch(key){caseLEFT:setfillstyle(1,9);floodfill(x+10,470,5);setcolor(9);rectangle(x,460,x+60,480);setcolor(5);setfillstyle(1,BLUE);if(x<=9){rectangle(0,460,60,480);floodfill(40,470,5);x=0;}else{recta
7、ngle(x-10,460,x+50,480);floodfill(x+20,470,5);x-=10;}return1;caseRIGHT: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);floo