void intro(void) { FILE *in; char ch; int i,j; int vk; clearScreen(); in = fopen("intro.txt","r"); /* 把檔案�堶悸漲r讀取並顯示出來 */ for(i=0;i<HEIGHT;i++) { for(j=0;j<WIDTH*2;j++) { while((ch = fgetc(in)) == '\n' || ch == '|' || ch == '-'); putASCII2(j + OFFSET_X,i + OFFSET_Y,ch,15,0); } } fclose(in); drawCmdWindow(); /* 當使用者按下 Enter 鍵即離開 */ while(1) { if(waitForKeyDown(1)) { vk=getKeyEventVirtual(); if(vk == VK_RETURN) break; } if(i==0) putString(46+OFFSET_X,18+OFFSET_Y," ",12,0); else putString(46+OFFSET_X,18+OFFSET_Y,"想離開請按 Enter ...",12,0); drawCmdWindow(); i= !i; } }
int main() { char logo[] ="Introduce to program 2010 by ml-Li"; int i; for(i=0; i<strlen(logo); i++) { putASCII2(0+i, 0, logo[i], 14, 1); /*putASCII2( int x, int y, int ch, int fgcolor, int bgcolor ); putASCII2()之中: int x 繪製後的字元出現的位置(column) int y 繪製後的字元出現的位置(row) int ch 欲繪製的字元 int fgcolor 字元前景的顏色 int bgcolor 字元背景的顏色 可以參考下面的顏色值對照表來設定你想要的顏色 0: 黑 1: 暗藍 2: 暗綠 3: 暗青 4: 暗紅 5: 暗紫 6: 暗黃 7: 淺灰 8: 暗灰 9: 亮藍 10: 亮綠 11: 亮青 12: 亮紅 13: 亮紫 14: 亮黃 15: 白*/ } drawCmdWindow(); //將繪製好的顏色show在畫面上 getch(); return 0; }
void ShowHelp(void) { clearScreen(); Image *help = read_image("help.pixel","help.color"); show_image(help,100,10); drawCmdWindow(); /* update window immediately */ Sleep(500); // <--- Sleep()單位是ms, sleep()單位是s }
void rankList(void) { FILE *in; char name[100]; char toString[100]; int score; int i=1; int vk; clearScreen(); in = fopen("ranklist.slmt","r"); putString(24+OFFSET_X,1+OFFSET_Y,"排 行 榜",11,5); while(fscanf(in,"%d,%s",&score,name) == 2) { sprintf(toString,"%d. %7d",i,score); putString(14+OFFSET_X,i*2+1+OFFSET_Y,toString,15,0); putString(44+OFFSET_X,i*2+1+OFFSET_Y,name,15,0); i++; } fclose(in); drawCmdWindow(); /* 當使用者按下 Enter 鍵即離開 */ while(1) { if(waitForKeyDown(1)) { vk=getKeyEventVirtual(); if(vk == VK_RETURN) break; } if(i==0) putString(46+OFFSET_X,18+OFFSET_Y," ",12,0); else putString(46+OFFSET_X,18+OFFSET_Y,"想離開請按 Enter ...",12,0); drawCmdWindow(); i= !i; } }
void showpic(void) { int a,b,c,d; scanf("%d,%d,%d,%d", &a, &b, &c, &d); int i,j; int row=16,column=16; //圖形長和寬 int pic[16][16]= //圖形矩陣 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0, 0,1,1,1,1,1,1,0,0,1,1,1,1,1,1,0, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0, 0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0, 0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0, 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0, 0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; system("cls"); //清除畫面 for(i=0;i<=row-1;i++){ for(j=0;j<=column-1;j++){ if(pic[i][j]==1){ printf("*"); putASCII2( j, i, pic[j][i], a, b); //當pic[i][j]==1時,顯示符號* }else if(pic[i][j]==0){ printf("*"); putASCII2( j, i, pic[j][i], c, d); //當pic[i][j]==0時,顯示一個空格 } /*上色function:putASCII2( int 開始繪圖的x座標, int 開始繪圖的y座標, int 繪圖對象的變數名稱, int 前景顏色, int 背景顏色 ) 最後兩個參數可以參考下面的顏色值對照表來設定你想要的顏色 0: 黑 1: 暗藍 2: 暗綠 3: 暗青 4: 暗紅 5: 暗紫 6: 暗黃 7: 淺灰 8: 暗灰 9: 亮藍 10: 亮綠 11: 亮青 12: 亮紅 13: 亮紫 14: 亮黃 15: 白 */ } printf("\n"); //當一列完全顯示出來後,換下一列 } //將之前描繪的前景/背景顏色show出來 drawCmdWindow(); }
void Loser() { loseTimes++; int count=1; Image *loser; int ran,i; srand( time(NULL) ); ran=rand()%2; while(count<=6) { clearScreen(); switch(count) { case 1: loser= read_image("Loser1.pixel","Loser1.color"); break; case 2: loser= read_image("Loser2.pixel","Loser2.color"); break; case 3: loser= read_image("Loser3.pixel","Loser3.color"); break; case 4: loser= read_image("Loser4.pixel","Loser4.color"); break; case 5: loser= read_image("Loser5.pixel","Loser5.color"); break; case 6: loser= read_image("Loser6.pixel","Loser6.color"); default: break; } count++; show_image(loser,120,35); drawCmdWindow(); /* update window immediately */ for(i=0; i<1; i++) { playAudio(&audioLose[ran]); //Sleep(100); } Sleep(300); } destroy_image(loser); showTable(); }
void Loser2(int x,int y) //small lose send location { int count=1; Image *loser; int ran,i; srand( time(NULL) ); ran=rand()%2; while(count<=6) { clearScreen(); switch(count) { case 1: loser= read_image("Loser21.pixel","Loser21.color"); break; case 2: loser= read_image("Loser22.pixel","Loser22.color"); break; case 3: loser= read_image("Loser23.pixel","Loser23.color"); break; case 4: loser= read_image("Loser24.pixel","Loser24.color"); break; case 5: loser= read_image("Loser25.pixel","Loser25.color"); break; case 6: loser= read_image("Loser26.pixel","Loser26.color"); default: break; } count++; show_image(loser,x,y); drawCmdWindow(); /* update window immediately */ for(i=0; i<1; i++) { playAudio(&audioLose[ran]); //Sleep(300); } Sleep(300); } destroy_image(loser); }
void show_image(Image *ip, int offx, int offy) { int x, y; char c; for (y=0; y<ip->row; y++) { for (x=0; x<ip->col; x++) { c = getimgpixel(ip, x, y); if (c!=' ') putASCII2( x + offx, y + offy, c, getimgcolor(ip, x, y), 0); } } drawCmdWindow(); }
int main(void) { initImage(); initPlace(); large_font = read_font("font.txt"); initAudio(); initAudioNUM(); int IsEnding = 0; showingPlane = START_PLANE; while (!IsEnding) { clearScreen(); switch (showingPlane) { case 0: start(); showingPlane = 1; break; case 1: Menu(); break; case 2: SinglePlayer(); break; case 3: MuitiplePlayers(); break; case 4: ShowHelp(); showingPlane = 1; break; } drawCmdWindow(); } /* while (IsEnding) */ return 0; }
void temp_ShowCounting(count) { char *card; card = (char*)malloc(sizeof(char)); *(card+1) = '\0'; if(count<10) *card = ('0'+count); else if(count == 11) *card = '+'; else if(count == 11) *card = 'J'; else if(count == 12) *card = 'Q'; else if(count == 13) *card = 'K'; putStringLarge(large_font, 10, 40, "NUM ", (*(counting_place+(count%2))).x,(*(poker_place+(count%2))).y); putStringLarge(large_font, 50, 40, card, (*(counting_place+(count%2))).x+20,(*(poker_place+(count%2))).y); drawCmdWindow(); free(card); }
void Winner2(int x,int y) { int count=1; Image *winner; int ran,i; srand( time(NULL) ); ran=rand()%2; int time=7; while(time--) { clearScreen(); switch(count) { case 1: winner= read_image("Winner21.pixel","Winner21.color"); break; case 2: winner= read_image("Winner22.pixel","Winner22.color"); break; case 3: winner= read_image("Winner23.pixel","Winner23.color"); break; default: break; } count=(count+1)%4; show_image(winner,x,y); drawCmdWindow(); /* update window immediately */ for(i=0; i<1; i++) { playAudio(&audioWin[ran]); //Sleep(300); } Sleep(200); } destroy_image(winner); }
void end(void) { int endp[25][80]={ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc6, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa4, 0x46, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa4, 0x55, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa7, 0x41, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa1, 0x5f, 0x20, 0x20, 0x20, 0x20, 0xa6, 0xb8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb3, 0xe1, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa4, 0x55, 0x20, 0x20, 0x20, 0x20, 0xa5, 0xd1, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc6, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa6, 0xb8, 0x20, 0x20, 0x20, 0x20, 0xa7, 0xda, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xaa, 0xba, 0x20, 0x20, 0x20, 0x20, 0xad, 0xcc, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc6, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa4, 0x46, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa5, 0x44, 0x20, 0x20, 0x20, 0x20, 0xa8, 0xd3, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xa1, 0xb4, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xa1, 0xb4, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa8, 0xa4, 0x20, 0x20, 0x20, 0x20, 0xc6, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc6, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa7, 0x41, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xac, 0x4f, 0x20, 0x20, 0x20, 0x20, 0xa1, 0x49, 0x20, 0x20, 0x20, 0x20, 0xa4, 0x46, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa4, 0x46, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa7, 0x41, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb3, 0xe1, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb3, 0xe1, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa1, 0x49, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa7, 0x41, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa1, 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc6, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa1, 0xf4, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb0, 0xb2, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa4, 0x46, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa1, 0x55, 0x20, 0x20, 0xa1, 0x55, 0x20, 0x20, 0xa1, 0x55, 0x20, 0x20, 0xa1, 0x55, 0x20, 0x20, 0xa1, 0x55, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xaa, 0xba, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa1, 0x55, 0x20, 0x20, 0xa1, 0x55, 0x20, 0x20, 0xa1, 0x55, 0x20, 0x20, 0xa1, 0x55, 0x20, 0x20, 0xa1, 0x55, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa7, 0x41, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc6, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa4, 0x46, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa7, 0x41, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb3, 0xe1, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xb5, 0xdf, 0xb5, 0xdf, 0xb5, 0xdf, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa2, 0xe0, 0xa2, 0xf1, 0xa2, 0xf5, 0xa2, 0xf1, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; int front[25][80]={0}; int back[25][80]={0}; int i,j; for(i=0;i<15;i++) { for(j=0;j<12;j++) { if(endp[i][j]!=0x20) { front[i][j]=15; back[i][j]=0; } } } for(i=0;i<15;i++) { for(j=12;j<52;j+=2) { if(endp[i][j]==0x44 && endp[i][j+1]==0x44) { front[i][j]=15; back[i][j]=15; front[i][j+1]=15; back[i][j+1]=15; } else if(endp[i][j]==0xa1 && endp[i][j+1]==0xb4) { front[i][j]=0; back[i][j]=11; front[i][j+1]=0; back[i][j+1]=11; } else if(endp[i][j]!=0x20 && endp[i][j+1]!=0x20) { front[i][j]=11; back[i][j]=11; front[i][j+1]=11; back[i][j+1]=11; } } } for(i=15;i<17;i++) { for(j=0;j<52;j++) { if(endp[i][j]!=0x20) { front[i][j]=15; back[i][j]=0; } } } for(i=0;i<17;i++) { for(j=52;j<56;j++) { if(endp[i][j]!=0x20) { front[i][j]=14; back[i][j]=0; } } } for(i=0;i<23;i++) { for(j=56;j<80;j++) { if(endp[i][j]!=0x20) { front[i][j]=15; back[i][j]=0; } } } for(i=17;i<25;i++) { for(j=0;j<56;j++) { if(endp[i][j]!=0x20) { front[i][j]=9; back[i][j]=9; } } } for(i=23;i<25;i++) { for(j=56;j<80;j++) { if(endp[i][j]==0x20) { front[i][j]=15; back[i][j]=0; } } } for(i=0;i<25;i++) { for(j=0;j<80;j++) { putASCII2(j,i,endp[i][j],front[i][j],back[i][j]); } drawCmdWindow(); delaye(0.2); } }
void saveScore(int FinScore) { FILE *in,*out; int i,j,temp; int k,l; char name[8][100]; char input[100]="\0"; char vk; char toString[10]; int score[8]; in = fopen("ranklist.slmt","r"); for(i=0;i<8;i++) { fscanf(in,"%d,%s",&score[i],name[i]); } fclose(in); i=0; while(FinScore < score[i]) i++; if( i < 8 ) { /* 把分數往後推一格 */ for(j=7;j>i;j--) score[j] = score[j-1]; /* 把姓名往後推一格 */ for(j=7;j>i;j--) strcpy(name[j],name[j-1]); score[i]=FinScore; /* 要求輸入姓名 */ j=0; while(1) { for(k=0;k<7;k++) for(l=0;l<32;l++) putASCII2(20 + l + OFFSET_X,8 + k + OFFSET_Y,' ',14,1); if(waitForKeyDown(0.5)) { vk=getKeyEventASCII(); if((isalpha(vk) || isdigit(vk) || vk == '.') && j<=15) { /* 接受英文字母、數字和點 */ input[j]=vk; j++; input[j]='\0'; } else if (vk == 0x08 && j>0) { /* 倒退鍵 */ j--; input[j]='\0'; } else if (vk == 0x0D) { /* Enter 鍵 */ if(input[0] != '\0') { strcpy(name[i],input); break; } } } sprintf(toString,"Yor Score:%5d",FinScore); putString(26+OFFSET_X,9+OFFSET_Y,toString,15,1); putString(23+OFFSET_X,10+OFFSET_Y,"Your Name: ",15,1); putString(34+OFFSET_X,10+OFFSET_Y,input,15,1); putString(22+OFFSET_X,12+OFFSET_Y,"請輸入您的名字(less than 15)",15,1); putString(28+OFFSET_X,13+OFFSET_Y,"按 Enter 完成",15,1); drawCmdWindow(); } } out = fopen("ranklist.slmt","w"); for(i=0;i<8;i++) { fprintf(out,"%d,%s\n",score[i],name[i]); } fclose(out); }
void MuitiplePlayers(void) { Font *large_font = read_font("font.txt"); /* 啟動鍵盤控制 */ initializeKeyInput(); char ch,prech='0'; char *card; card = (char*)malloc(sizeof(char)); *(card+1) = '\0'; int isWin=0,isLose=0; int count = 0, pick; int initime =clock(), time; int turn=2; // 1:Right 2:Left while(isWin<3 && isLose<3) { clearScreen(); time = clock() - initime; ch = getKeyEventVirtual(); switch(ch) { case VK_LEFT: //右方拍桌 if(( count==pick && time<10 )|| count==14) { //win(10); putStringLarge(large_font, 200, 20, "YOU WIN!!", 15, 15); drawCmdWindow(); Sleep(200); turn = 2; time = 0; isLose++; } else if(count==pick) {//show_image(*(poker+1),0,0); //drawCmdWindow(); //AIwin(); putStringLarge(large_font, 200, 20, "YOU LOSE! How slow you are!", 15, 15); drawCmdWindow(); Sleep(200); turn = 1; time = 0; isWin++; } else { //lose(10); putStringLarge(large_font, 200, 20, "YOU LOSE! Watch out the number!", 15, 15); drawCmdWindow(); Sleep(200); turn = 1; time = 0; isWin++; } break; break; case 0x58: //左方拍桌 if(( count==pick && time<10 )|| count==14) { //win(10); putStringLarge(large_font, 10, 20, "YOU WIN!!", 15, 15); drawCmdWindow(); Sleep(200); turn = 1; time = 0; isWin++; } else if(count==pick) { //AIwin(); putStringLarge(large_font, 10, 20, "YOU LOSE! How slow you are!", 15, 15); drawCmdWindow(); Sleep(200); turn = 2; time = 0; isLose++; } else { //lose(10); putStringLarge(large_font, 10, 20, "YOU LOSE! Watch out the number!", 15, 15); drawCmdWindow();//show_image(*(poker+1),0,0); //drawCmdWindow(); Sleep(200); turn = 2; time = 0; isLose++; } break; case 0x5A: //左方發牌 if(count==pick|| count==14) { putStringLarge(large_font, 10, 20, "YOU LOSE! Watch out the number!", 15, 15); drawCmdWindow(); Sleep(200); turn = 2; time = 0; isLose++; } else if(turn == 2) { count = count%13 +1; if(count<11) *card = ('0'+count); else if(count == 11) *card = 'J'; else if(count == 12) *card = 'Q'; else if(count == 13) *card = 'K'; putStringLarge(large_font, 100, 40, "NUM ", 0, 15); putStringLarge(large_font, 150, 40, card, 0, 15); pick = (rand()%13)+1; if(pick<11) *card = ('0'+pick); else if(pick == 11) *card = 'J'; else if(pick == 12) *card = 'Q'; else if(pick == 13) *card = 'K'; else if(pick == 14) *card = 'P'; putStringLarge(large_font, 100, 50, "CARD ", 0, 15); putStringLarge(large_font, 150, 50, card, 0, 15); time = 0; turn = 1; int ran = (rand()%4)+1; //show_image(poker[0][0],100,20); drawCmdWindow(); }//show_image(*(poker+1),0,0); //drawCmdWindow(); break; case VK_DOWN: //右方發牌 if(count==pick|| count==14) { putStringLarge(large_font, 200, 20, "YOU LOSE! Watch out the number!", 15, 15); drawCmdWindow(); Sleep(200); turn = 1; time = 0; isWin++; } else if(turn == 1) { count = count%13 +1; if(count<11) *card = ('0'+count); else if(count == 11) *card = 'J'; else if(count == 12) *card = 'Q'; else if(count == 13) *card = 'K'; putStringLarge(large_font, 100, 40, "NUM ", 0, 15); putStringLarge(large_font, 150, 40, card, 0, 15); pick = (rand()%13)+1; if(pick<11) *card = ('0'+pick); else if(pick == 11) *card = 'J'; else if(pick == 12) *card = 'Q'; else if(pick == 13) *card = 'K'; else if(pick == 14) *card = 'P'; putStringLarge(large_font, 100, 50, "CARD ", 0, 15); putStringLarge(large_font, 150, 50, card, 0, 15); time = 0; turn = 2; int ran = (rand()%4)+1; //show_image(poker[0][0],100,20); drawCmdWindow(); } break;//show_image(*(poker+1),0,0); //drawCmdWindow(); case VK_ESCAPE: break; } } if(winTimes==3) { Loser2(50,35);//send location Winner2(300,35);//send location showingPlane =1; } else if(loseTimes==3) { Loser2(300,35);//send location Winner2(50,35);//send location showingPlane =1; } }
int single_game(){ Audio RRR; openAudioFile(".\\wav\\RRR.wav", &RRR); initializeKeyInput(); Character yg = characterMaking1(".\\pic\\yg.pixel",".\\pic\\yg.color"); int key_val[NUM_KEYS]={VK_A,VK_D,VK_ESCAPE}; int stand=0,score=0,standBrick,pDown1,pDown2; double drop=0,scoreCount=0; Brick bricks[15]; int i,j,k; char scoreStr[4]={'0'}; for(i=0;i<10;i++){ bricks[i].y=-1; bricks[i].w=40; bricks[i].h=2; if(i%2==0)bricks[i].color=15; else if(i<=5)bricks[i].color=8; else if(i>5)bricks[i].color=12; else bricks[i].color=10; } bricks[0].x=0; bricks[0].y=100; Font *large_font=read_font("font.txt"); float lastbrick=0; int hp = 10,second=0; float rate=0.15; while(1){ clearScreen(); srand(clock()); for(i=0;i<10;i++){ if(bricks[i].y>0)bricks[i].y--; else if(bricks[i].y==0)bricks[i].y=-100; for(k=0;k<2;k++){ for(j=0;j<bricks[k].w;j++){ putString(bricks[i].x+j,bricks[i].y+k,"=",bricks[i].color,0); } } } if(score>50){ rate = 0.2; } else if(score>75){ rate = 0.25; } else if(score>100){ rate = 0.3; } if((float)clock()/(float)CLOCKS_PER_SEC-(float)lastbrick>rate&&rand()%10==1){ for(i=0;i<10;i++){ if(bricks[i].y<0){ bricks[i].y=170; bricks[i].x=rand()%185; lastbrick=(float)clock()/(float)CLOCKS_PER_SEC; for(k=0;k<2;k++){ for(j=0;j<bricks[i].w;j++){ putString(bricks[i].x+j,bricks[i].y+k,"=",bricks[i].color,0); } } break; } } } for(k=0;k<10;k++){ if(abs(yg.y+yg.h-bricks[k].y)<=2&&( (yg.x+yg.w>bricks[k].x&&yg.x+yg.w<bricks[k].x+bricks[k].w)|| (yg.x>bricks[k].x&&yg.x<bricks[k].x+bricks[k].w))){ stand=1; standBrick=k; yg.y=bricks[k].y-yg.h; break; } else if(k==9){ stand=0; standBrick=-1; } } if(stand==1){ drop=0; second++; if(bricks[standBrick].color==15&&second==15){ second=0; if(hp<10)hp++; } else if(bricks[standBrick].color==12){ second++; if(second==20){ second=0; hp--; playAudio(&RRR); } } else if(bricks[standBrick].color==8){ if(second==10){ second=0; bricks[standBrick].y=-100; } } } else{ if(drop<2)drop+=0.5; yg.y+=(int)drop; second=0; } if(yg.y<0){ yg.y+=10; drop=3; hp-=4; playAudio(&RRR); } for (k = 0 ; k < NUM_KEYS ; k++){ if(KEY_DOWN(key_val[k])){ switch (key_val[k]){ case VK_A: if(yg.x>=0)yg.x-=5; break; case VK_D: if(yg.x+yg.w<225)yg.x+=5; break; case VK_ESCAPE: return 3; break; } } } show_image(yg.pic,yg.x,yg.y); for(i=0;i<225;i++){ for(j=151;j<=170;j++){ putString(i,j," ",0,0); } } putStringLarge(large_font,159,158,"HP ",15); putStringLarge(large_font,159,152,"STAGE ",15); scoreCount++; score = (pow(scoreCount/300,1.5)); scoreStr[0]=score/100+'0'; scoreStr[1]=score/10%10+'0'; scoreStr[2]=score%10+'0'; putStringLarge(large_font,201,152,scoreStr,15); for(i=0;i<hp;i++){ for(j=1;j<5;j++){ for(k=0;k<=4;k++)putString(180+i*4+j,158+k,"|",12,0); } } for(i=0;i<225;i++)putString(i,0,"V",12,0); for(i=0;i<225;i++){ putString(i,149,"=",12,0); } for(i=0;i<150;i++){ putString(0,i,"|",0,12); putString(224,i,"|",0,12); } drawCmdWindow(); if(yg.y>150||hp<=0){ break; }; if(KEY_UP(VK_P)&&pDown1)pDown1=0; if(KEY_UP(VK_P)&&pDown2)pDown2=0; if(KEY_DOWN(VK_P)&&!pDown1){ pDown1=1; putStringLarge(large_font,45,70,"Press P to continue",12); drawCmdWindow(); Sleep(500); while(1){ if(KEY_DOWN(VK_P)&&!pDown2){ pDown2=1; break; } } } Sleep(20); } pauseAudio(&RRR); Image * jh =read_image(".\\pic\\jh.pixel",".\\pic\\jh.color"); show_image(jh,15,30); putStringLarge(large_font,75,80,"SCORE ",15); putStringLarge(large_font,120,80,scoreStr,15); drawCmdWindow(); Audio *barbar; openAudioFile(".\\wav\\88wav.wav",&barbar); playAudio(&barbar); Sleep(3500); int flagg = 1; putStringLarge(large_font, 45, 90, "Press esc to exit", 15); drawCmdWindow(); while(flagg){ if(KEY_DOWN(VK_ESCAPE))return 3; } clearScreen(); }
void start() { int count=1; int ok=0; Image *start; int time=20;//29 while(time--) { clearScreen(); switch(count) { case 1: start= read_image("start1.pixel","start1.color"); break; case 2: start= read_image("start2.pixel","start2.color"); break; case 3: start= read_image("start3.pixel","start3.color"); break; case 4: start= read_image("start4.pixel","start4.color"); break; case 5: start= read_image("start5.pixel","start5.color"); break; case 6: start= read_image("start6.pixel","start6.color"); break; case 7: start= read_image("start7.pixel","start7.color"); break; case 8: start= read_image("start8.pixel","start8.color"); break; case 9: start= read_image("start9.pixel","start9.color"); break; case 10: start= read_image("start10.pixel","start10.color"); break; case 11: start= read_image("start11.pixel","start11.color"); break; case 12: start= read_image("start12.pixel","start12.color"); break; case 13: start= read_image("start13.pixel","start13.color"); break; case 14: start= read_image("start14.pixel","start14.color"); break; case 15: start= read_image("start15.pixel","start15.color"); break; case 16: start= read_image("start16.pixel","start16.color"); break; default: break; } if(count==16) { ok=1; } if(ok) { // count=(count+1)%16+10; if(count==15) { count=16; } else { count=15; } } else { count++; } show_image(start,125,35); drawCmdWindow(); int i=0; for(i=0; i<1; i++) { playAudio(&audio[0]); //Sleep(500); } Sleep(500); } destroy_image(start); }
void gameover() { int count=2; Image *gameover; int ran,i; srand( time(NULL) ); ran=rand()%6; while(count<=11) { clearScreen(); switch(count) { case 2: gameover= read_image("gameover2.pixel","gameover2.color"); break; case 3: gameover= read_image("gameover3.pixel","gameover3.color"); break; case 4: gameover= read_image("gameover4.pixel","gameover4.color"); break; case 5: gameover= read_image("gameover5.pixel","gameover5.color"); break; case 6: gameover= read_image("gameover6.pixel","gameover6.color"); break; case 7: gameover= read_image("gameover7.pixel","gameover7.color"); break; case 8: gameover= read_image("gameover8.pixel","gameover8.color"); break; case 9: gameover= read_image("gameover9.pixel","gameover9.color"); break; case 10: gameover= read_image("gameover10.pixel","gameover10.color"); break; case 11: gameover= read_image("gameover11.pixel","gameover11.color"); break; default: break; } count++; show_image(gameover,120,35); drawCmdWindow(); if(count%4==0) { for(i=0; i<2; i++) { playAudio(&audioOver[ran]); //Sleep(300); } } Sleep(300); } destroy_image(gameover); }