c语言吃豆豆游戏,高手帮我改下我的吃豆豆游戏吧

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

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();}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值