Game menu interface design and game integration

 

A child always felt those games 4399 games menu good low, now go back and finish my menu interface to see I feel pretty good. . .

Menu production process

The complete code

https://paste.ubuntu.com/p/HZBWXMWT8K/

Details:

<!--more-->

Foreword

From Maze on, to backgammon, chess and then to finish, and then go to school the next library management system programming. In fact, I do not have a great interest in the game or management systems, interface design before that trouble, I feel that the library management system procedures c language book is boring, but also feel that the game and cumbersome and tired, and since that day simply learn wasd after that move could be so cleverly controlled the ball moving, it really incense. . .

The initiative to do it might be asked to do more than a passive interest in some.

menu design:

  • Library management system on the C language book: the game menu system reference

 while(1)         //主体程序
  {
menu();
char choise;
choise = getch();
       switch(choise)
      {
       case '1': xiangqi();break;
       case '2': wuziqi();break;
       case '3': system("cls");printf("\n\n还在开发呢~~返回菜单\n\n");Sleep(1000);break;
       case '4': more();break;
       case '5': {system("cls");
printf("\n\n确定退出吗\n\n1.Yes   2.No\n");
printf("\n( 1 / 2 )\n");
char b;
b = getch();
if( b == '1') return 0;
else if( b == '2') break;
else break;
default: printf("请输入1 / 2确定是与否");Sleep(1000);break;
}
  }
   

 

  • 新增功能:页面加入加载效果(Sleep),实现“按任意键继续”功能(getch)。

    for(i = 0; i < 37; i++)       //实现起来都挺简单
  {
puts(map[i]);
Sleep(100);
}
    printf("任意键继续\n");
   getch();

 

游戏整合:

  • 主函数只负责调用菜单界面和循环选择;

  • 菜单界面负责循环选择进入多个独立的自定义游戏函数;

  • 原来的游戏若没有调用函数则直接打包扔进自定义游戏函数里去(把main函数去了)

  • 原来游戏若调用了函数则游戏主程序放相应的游戏函数,调用函数放外面。若需要改变实参,则还需调整。

 

整体这里难度都没有象棋那边大。

但给了后面写系统程序做了铺垫

待更ing

Guess you like

Origin www.cnblogs.com/404name/p/12177692.html