bubble.cpp
资源名称:泡泡龙源代码.zip [点击查看]
上传用户:junwei_58
上传日期:2007-05-15
资源大小:79k
文件大小:2k
源码类别:
其他智力游戏
开发平台:
Visual C++
- #define BUBBLE_CPP
- #include "game.h"
- int problem;
- char *problemStr[5]={
- " ",//no problem for zero
- "I'm sorry! This version does not have the function.",
- " "," "," ",
- };
- #include "bubble.c"
- void main(){
- Image titleI;
- int m,n,p=0;
- int r1,r2,c;
- time_t t;
- srand((unsigned) time(&t));
- if(!loadtop10())return;
- installTimer();
- installKeyFunc();
- inGame=KEYNEW;
- printf("Welcome to Bubble nn");
- printf("Left and Right to turn the snake's directionnUp to speed upn");
- printf("Enjoy yourself!nAny key to start...");
- getch_Key();
- //*
- //initalize data and symbles:
- ob=new object;
- players=0;// at first only 1 player joined in
- musicON=1;
- soundON=1;
- initVBEMode(0x103);
- setPalette();
- titleI.width=80; titleI.height=16;
- titleI.bytesperpixel=bytesperpixel;
- char buf[1440];
- titleI.imgbuf=buf;
- char title2[]="Bubble";
- setcolor(TEXTCOLOR);
- setbkcolor(BKGROUNDCOLOR);
- //Imgctextxy(titleI,0,0,title,0);
- Imgtextxy(titleI,0,0,title2,0);
- textxy(300,240,"PRESS ANY KEY TO START",0);
- // putimage(300,200,titleI,COPY_PUT);
- while(wait_Key()){
- r1 = (rand() % 70);
- r2 = (rand() % 16);
- c=(int)Imggetpixel(titleI,r1,r2);
- if((p%13000)==0){
- n=(rand()%16)*10;
- m=(rand()%16)*10;
- }
- p++;
- if(c==TEXTCOLOR){
- r1*=2;
- r2*=2;
- r1+=rand()%2;
- c=rand()%10+n;// 32 ~ 63
- setpixel(r1+334,r2+200,c);
- c=rand()%10+m;
- setpixel(r1+331,r2+197,c);
- delay(1);
- }
- }
- smoothout();
- setcolor(BORDERCOLOR);
- clrScr(BKGROUNDCOLOR);
- MainMenu.key();// display menu and start game;*/
- //normal exit:
- savetop10();
- exitgame();
- }
- void thegameloop(){
- ready_GO();
- rectant(XMAGIN,YMAGIN,BALLSIZE*TABLEWIDTH+BALLSIZE/2+1,BALLSIZE*(TABLEHEIGHT-1));
- lineH(XMAGIN-30,YMAGIN+BALLSIZE*15,30);
- lineH(XMAGIN+BALLSIZE*TABLEWIDTH+BALLSIZE/2,YMAGIN+BALLSIZE*15,30);
- ob->start();
- if(players==1||players==2)ob2->start();
- gameover=0;
- seekActions();
- checktop10(ob->getscore(),0);
- if(players==1||players==2){
- checktop10(ob2->getscore(),1);
- }
- }