该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
void LOST(){ flag=0; move=NO; clrscr(); getch(); clrscr(); false1();}
void enemy(int num){ int direct; randomize(); direct=random(4)+1; switch(direct) { case 1:if(em[num]>0&&map[em[num]-1][en[num]]!='#'&&map[em[num]-1][en[num]]!='$') { --em[num]; textcolor(BLACK); gotoxy(ex[num],ey[num]); putch(' '); textcolor(BROWN); gotoxy(ex[num],--ey[num]); putch(232); } if(ex[num]==x&&ey[num]==y) LOST(); break; case 2:if(en[num]>0&&map[em[num]][en[num]-1]!='#'&&map[em[num]][en[num]-1]!='$') { --en[num]; textcolor(BLACK); gotoxy(ex[num],ey[num]); putch(' '); textcolor(BROWN); gotoxy(--ex[num],ey[num]); putch(232); } if(ex[num]==x&&ey[num]==y) LOST(); break; case 3:if(en[num]
void enemynum(int ene){ for(i=0;i
void facemove(){char ch;ch=getch();while(flag){switch(ch){ case KEY_W:while((!kbhit())&&move) { moveup(); enemynum(ENEMY); delay(speed); }break; case KEY_S:while((!kbhit())&&move) { movedown(); enemynum(ENEMY); delay(speed); }break; case KEY_A:while((!kbhit())&&move) { moveleft(); enemynum(ENEMY); delay(speed); }break; case KEY_D:while((!kbhit())&&move) { moveright(); enemynum(ENEMY); delay(speed); }break; case KEY_ESC:flag=0; gotoxy(26,24); printf("Prease any key to Exit!"); break;}ch=getch();}}
void hero() { FILE *fp; clrscr(); textbackground(11); textcolor(RED); clrscr(); gotoxy(10,3); printf("Thanks playing!Please input your name:"); scanf("%s",pla[i].name); fp=fopen("hero.txt","a"); fwrite(&pla[i].name,sizeof(struct player),1,fp); fclose(fp); getch(); clrscr(); textmode(C80); textbackground(10); gotoxy(20,5); printf("**********Hero score**********\n"); fp=fopen("hero.txt","r"); for(i=0;i<3;i++) { fseek(fp,i*sizeof(struct player),0); fread(&pla[i],sizeof(struct player),1,fp); gotoxy(20,5+i+1); printf("%s%d",pla[i].name,pla[i].score); } fclose(fp); getch(); }void sund() { int a; for(a=0;a<2;a++){ sound(1500);delay(100); sound(0); delay(50); sound(800); delay(100); sound(0); delay(50); sound(1500);delay(100); sound(0); delay(50); sound(800); delay(100); sound(0); delay(50); nosound(); } }
void main(){ start(); getch(); printf("Have fun!"); drawmap(); facemove(); sund(); hero();}