推箱子游戏(算法设计)

推箱子程序设计:

设计思想:

(1)确定软件的功能:
让玩家通过按w,s,a,d键推箱子,当箱子们都推到了目的地后出现过关信息,并显示下一关。推错了玩家还按1从新新选关。直到过完全部关卡。每过完一关都会出现重新选关或者回到主页面退出游戏。
(2)定义软件的核心数据结构:
我们定义一个二维数组MAP来记录屏幕上各点的状态。char MAP [20][20]其中:0表示空格,1表示墙,2表示箱子,3表示目的地,4 表示玩家,5 表示箱子在的目的地上7 表示人在目的地上
(3)对整个软件进行功能模块的划分:
(3.1)初始化:在屏幕上输出欢迎信息,在main函数进行选择。并根据各关的要求在屏幕上输出墙、箱子、目的地和人。并用MAP[][]数组记录各点的状态。
(3.2)进入游戏循环:这个游戏主循环是等待按键。当接受到上下左右键时执行相关操作:接受00键退出游戏;接受1键时返回本关头;接受2键返回主菜单;接受无效按键时做忽略处理。
(3.3)判断是否过关:用一个链表win由每关的初始化函数传给main函数。Wain函数每执行一次操作后

函数介绍:

1:main()主函数
首先进入界面,然后选择,按‘1’,开始游戏;按‘0’,退出游戏;按‘2’,人员介绍;按 ‘3’玩法介绍;按‘其他’,重新选择。
2:Game()游戏函数
(1)输入值后判断是否为0,是0返回主菜单,不是重新选关;
(2)完成后,输入‘1’重新选关;输入‘2’返回主菜单;输入其他 自动进行下一关;
3:void player_act()函数
这是记录玩家的,输入‘1’,重新选关;输入‘w’,向上走;输入‘s’向下走;输入‘a’,向左走;输入‘d’,向右走;
4:void print_map()函数: 这是主要打印地图的函数。

程序测试:

1开始游戏界面
在这里插入图片描述
2 介绍页面:
在这里插入图片描述
在这里插入图片描述
3游戏界面:
在这里插入图片描述
在这里插入图片描述
4结束界面:
在这里插入图片描述
在这里插入图片描述

设计体会:

为了提高我们的实践能力,让我们学以致用,能运用所学知识进行创造,老师指导我们进行游戏设计。在这次制作推箱子游戏过程中我们组都有很大收获,我们游戏分好几个功能,通过不同的按键去实现不同的功能达到不同的页面。通过画流程图可以让我们设计的思想更明确。其中最难的就是编辑程序代码,虽然我们主要是在网上下载源代码,但是我们在反复修改代码的时候,会发现总体设计和一些函数的实现出现问题,通过不断的改进,不仅可以让程序达到预期效果,而且还能让我们在修改的过程中去学习。我们利用上学期和这学期所学的C语言知识来编写程序,让我们对一些较困难的知识了解更清楚(例如我们运用了函数、结构体、指针和链表等)。、

程序代码: 有点长哈–_--

#define __TUIXIANGZI_H__
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <Windows.h>
#include <conio.h>
#define ROW 12   //地图行数
#define COL 12   //地图列数
#define NUM 6   //地图总数
#define _CRT_SECURE_NO_WARNINGS 1
#define _CRT_SECURE_NO_WARNINGS 1
#include<windows.h>
struct MAP
{
    const int row;
    const int col;
    char map[ROW][COL];
};
void color();

void menu();  //菜单

void qinzhu();// 圣诞树
 
void game();  //游戏实现函数

void jsao(); 

void wanfa(); 

void jiesu();

void print_map(char (*map)[COL], const int *row, const int *col);  //打印地图

void find_man(char (*map)[COL], const int *row, const int *col, int *x, int *y);  //找到玩家的坐标

void player_act(char (*map)[COL], int *x, int *y);  //玩家控制小人行动

int is_win(char (*map)[COL], const int *row, const int *col);    //判断是否胜利

int main()
{
    int input=0 ;
    color();
	menu();        
	printf("\n\n\n");
    printf("\t\t\t请选择想要进行的操作:>>>");
    do
    {
        scanf("%d", &input);
        switch (input)
        {
        case 2:  system("cls"),jsao();
            break;
        case 0:  system("cls"),jiesu();					
            break;
        case 1:  system("cls"), game();
        	break;	
        case 3:  system("cls"),wanfa();
        	break;
        default:  system("cls"), printf("\n\n\n\n\t\t**你选择的选项有误,贾维斯看不懂**\n\n");
				  printf("\t\t**按任意键继续回到主菜单,请按要求重新选择**\n");
				   getch(); system("cls");main();
        	 break;	    
        }
    }
	while (input);
    return 0;
}
void jiesu()
{
	system("cls");
	printf("\n\n\n\t\t-------...........------------\n");
     printf("\n\n\n\t\t-------欢迎下次再来!!!--------\n\n");
	printf("\t\t\t\t\t\t\t再见\n\n\n\n\n\n\n");
	printf("\n\n\n\n\t\t\t\t\t\t\t按-*-'00'-*-键退出   "); 
	system("exit");
}
struct MAP all_map[NUM] = 
{ //地图一
{ 8, 8, { 
{ 0, 0, 1, 1, 1, 0, 0, 0 },  
{ 0, 0, 1, 3, 1, 0, 0, 0 },
{ 0, 0, 1, 0, 1, 1, 1, 1 },
{ 1, 1, 1, 2, 0, 2, 3, 1 },
{ 1, 3, 0, 2, 4, 1, 1, 1 },
{ 1, 1, 1, 1, 2, 1, 0, 0 },
{ 0, 0, 0, 1, 3, 1, 0, 0 },
{ 0, 0, 0, 1, 1, 1, 0, 0 } } },
//地图二 
{ 8, 8, {               
{ 0, 1, 1, 1, 1, 1, 0, 0 },  
{ 0, 1, 0, 4, 0, 1, 1, 1 },
{ 1, 1, 0, 1, 2, 0, 0, 1 },
{ 1, 0, 0, 3, 0, 3, 0, 1 },
{ 1, 0, 0, 2, 0, 0, 1, 1 },
{ 1, 1, 1, 0, 0, 0, 1, 0 },
{ 0, 0, 1, 0, 0, 0, 1, 0 },
{ 0, 0, 1, 1, 1, 1, 1, 0 } } },
 //地图三 
{ 9, 9, { 
{1,1,1,1,1,0,0,0,0},  
{1,4,0,0,1,0,0,0,0},
{1,0,2,2,1,0,1,1,1},
{1,0,2,0,1,0,1,3,1},
{1,1,1,0,1,1,1,3,1},
{0,1,1,0,0,0,0,3,1},
{0,1,0,0,0,1,0,0,1},
{0,1,0,0,0,1,1,1,1},
{0,1,1,1,1,1,0,0,0} } },
 //地图四
{ 7, 10, { 
{ 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 }, 
{ 0, 1, 0, 0, 0, 0, 0, 1, 1, 1 },
{ 1, 1, 2, 1, 1, 1, 0, 0, 0, 1 },
{ 1, 0, 4, 0, 2, 0, 0, 2, 0, 1 },
{ 1, 0, 3, 3, 1, 0, 2, 0, 1, 1 },
{ 1, 1, 3, 3, 1, 0, 0, 0, 1, 0 },
{0,1,1,1,1,1,1,1,1,0} } },
  //地图五
{ 8, 6, {
{ 0, 1, 1, 1, 1, 0 },  
{ 1, 1, 0, 0, 1, 0 },
{ 1, 4, 2, 0, 1, 0 },
{ 1, 1, 2, 0, 1, 1 },
{ 1, 1, 0, 2, 0, 1 },
{ 1, 3, 2, 0, 0, 1 },
{ 1, 3, 3, 5, 3, 1 },
{ 1, 1, 1, 1, 1, 1 } } }
}; 		
void menu()  //菜单
{
	printf("\n\n\n\n\n\n");
    printf("\t\t\t***********************\n");
    printf("\t\t\t***    1.开始游戏   ***\n");
    printf("\t\t\t***                 ***\n");
    printf("\t\t\t***    0.退出游戏   ***\n");
    printf("\t\t\t***                 ***\n");
    printf("\t\t\t***    2.人员介绍   ***\n");
    printf("\t\t\t***                 ***\n");
    printf("\t\t\t***    3.玩法介绍   ***\n");
    printf("\t\t\t***                 ***\n");
    printf("\t\t\t***    其他键无效   ***\n");
    printf("\t\t\t***********************\n");   
}
     
void wanfa()
{
	char ch;
	system("cls");
	printf("\n\n\n");
	printf("\t\t\t\t操作方法\n");
	printf("\n\n");
	printf("\t\t\t*-*-*  按'W',向上走!  *-*-*\n\n");
	printf("\t\t\t*-*-*  按'S',向下走!  *-*-*\n\n");
	printf("\t\t\t*-*-*  按'A',向左走!  *-*-*\n\n");
	printf("\t\t\t*-*-*  按'D',向右走!  *-*-*\n\n");
	printf("\n");
    printf("\n\t\t■表示墙,□表示箱子,◎表示目的地\n");
    printf("\n\t\t♀表示玩家,★表示箱子在目的地上,@表示人在目的地上\n");
    printf("\n\n\n\n\n\n\n\n\t\t\t\t\t\t按任意键返回上一步"); 
	getch();
	system("cls");
	main();
}  
void find_man(char (*map)[COL], const int *row, const int *col, int *x, int *y)  //找到玩家的坐标
{
    int i = 0;
    for (i = 0; i < *row; i++)
    {
        int j = 0;
        for (j = 0; j < *col; j++)
        {
            if ((map[i][j] == 4) || (map[i][j] == 7))
            {
                *x = i;
                *y = j;
                return;
            }
        }
    }
}
void print_map(char (*map)[COL], const int *row, const int *col)  //打印地图
{
    int i = 0;
    system("cls");
    printf("-------------------------------------------------------------\n");
    printf("-------------------------------------------------------------\n\n");
    for (i = 0; i < *row; i++)
    {
		printf("\t\t\t\t\t");
        int j = 0;	
        for (j = 0; j < *col; j++)
        {
            switch ((map[i][j]))
                {
				
                case 0:   printf("  ");
                    break;
                case 1:printf("■");
                    break;
                case 2:printf("□");
                    break;
                case 3:printf("◎");
                    break;
                case 4:printf("♀");
                    break;
                case 5: printf("★");
                    break;
                case 7: printf("@");
                    break;
                }
        }
        printf("\n");
    }
    printf("\nW A S D 控制小人的上下左右\n");
    printf("结束\n");
    printf("-------------------------------------------------------------\n");
    printf("-------------------------------------------------------------\n\n\n");
	printf("\t\t\t按1重新选关\n\n");
}
int is_win(char (*map)[COL], const int *row, const int *col)    //判断是否胜利
{
    int dest = 0;
    int i = 0;
    for (i = 0; i < *row; i++)
    {
        int j = 0;
        for (j = 0; j < *col; j++)
        {
            if (map[i][j] == 2 || map[i][j] == 7)
                return 0;
        }
    }
    return 1;
}
void player_act(char (*map)[COL], int *x, int *y)  //玩家控制小人行动,有点多哈
{
    char input = 0;
    switch (input = _getch())
    {
    case '1':  	system("cls"),game(); break;
    case 'W':
    case 'w':  
    case 38://向上走
        {
            if (map[(*x) - 1][*y] == 0 && map[*x][*y] == 4)
            {
                map[*x][*y] = 0;
                map[(*x) - 1][*y] = 4;
                --*x;
            }
            else if (map[(*x) - 1][*y] == 0 && map[*x][*y] == 7)
            {
                map[*x][*y] = 3;
                map[(*x) - 1][*y] = 4;
                --*x;
            }
            else if (map[(*x) - 1][*y] == 3 && map[*x][*y] == 7)
            {
                map[*x][*y] = 3;
                map[(*x) - 1][*y] = 7;
                --*x;
            }
            else if (map[(*x) - 1][*y] == 3 && map[*x][*y] == 4)
            {
                map[*x][*y] = 0;
                map[(*x) - 1][*y] = 7;
                --*x;
            }
            else if (map[(*x) - 1][*y] == 0 && map[*x][*y] == 7)
            {
                map[*x][*y] = 3;
                map[(*x) - 1][*y] = 4;
                --*x;
            }
            else if (map[(*x) - 1][*y] == 2 && map[*x][*y] == 4 && map[(*x) - 2][*y] == 0)
            {
                map[*x][*y] = 0;
                map[(*x) - 1][*y] = 4;
                map[(*x) - 2][*y] = 2;
                --*x;
            }
            else if (map[(*x) - 1][*y] == 2 && map[*x][*y] == 7 && map[(*x) - 2][*y] == 0)
            {
                map[*x][*y] = 3;
                map[(*x) - 1][*y] = 4;
                map[(*x) - 2][*y] = 2;
                --*x;
            }
            else if (map[(*x) - 1][*y] == 2 && map[*x][*y] == 7 && map[(*x) - 2][*y] == 3)
            {
                map[*x][*y] = 3;
                map[(*x) - 1][*y] = 4;
                map[(*x) - 2][*y] = 5;
                --*x;
            }
            else if (map[(*x) - 1][*y] == 2 && map[*x][*y] == 4 && map[(*x) - 2][*y] == 3)
            {
                map[*x][*y] = 0;
                map[(*x) - 1][*y] = 4;
                map[(*x) - 2][*y] = 5;
                --*x;
            }
            else if (map[(*x) - 1][*y] == 5 && map[*x][*y] == 7 && map[(*x) - 2][*y] == 3)
            {
                map[*x][*y] = 3;
                map[(*x) - 1][*y] = 7;
                map[(*x) - 2][*y] = 5;
                --*x;
            }
            else if (map[(*x) - 1][*y] == 5 && map[*x][*y] == 4 && map[(*x) - 2][*y] == 0)
            {
                map[*x][*y] = 0;
                map[(*x) - 1][*y] = 7;
                map[(*x) - 2][*y] = 2;
                --*x;
            }
            else if (map[(*x) - 1][*y] == 5 && map[*x][*y] == 4 && map[(*x) - 2][*y] == 3)
            {
                map[*x][*y] = 0;
                map[(*x) - 1][*y] = 7;
                map[(*x) - 2][*y] = 5;
                --*x;
            }
        }
        break;
    case 'S':
    case 's':   
    case 40://向下走
        {
            if (map[(*x) + 1][*y] == 0 && map[*x][*y] == 4)
            {
                map[*x][*y] = 0;
                map[(*x) + 1][*y] = 4;
                ++*x;
            }
            else if (map[(*x) + 1][*y] == 0 && map[*x][*y] == 7)
            {
                map[*x][*y] = 3;
                map[(*x) + 1][*y] = 4;
                ++*x;
            }
            else if (map[(*x) + 1][*y] == 3 && map[*x][*y] == 7)
            {
                map[*x][*y] = 3;
                map[(*x) + 1][*y] = 7;
                ++*x;
            }
            else if (map[(*x) + 1][*y] == 3 && map[*x][*y] == 4)
            {
                map[*x][*y] = 0;
                map[(*x) + 1][*y] = 7;
                ++*x;
            }
            else if (map[(*x) + 1][*y] == 0 && map[*x][*y] == 7)
            {
                map[*x][*y] = 3;
                map[(*x) + 1][*y] = 4;
                ++*x;
            }
            else if (map[(*x) + 1][*y] == 2 && map[*x][*y] == 4 && map[(*x) + 2][*y] == 0)
            {
                map[*x][*y] = 0;
                map[(*x) + 1][*y] = 4;
                map[(*x) + 2][*y] = 2;
                ++*x;
            }
            else if (map[(*x) + 1][*y] == 2 && map[*x][*y] == 7 && map[(*x) + 2][*y] == 0)
            {
                map[*x][*y] = 3;
                map[(*x) + 1][*y] = 4;
                map[(*x) + 2][*y] = 2;
                ++*x;
            }
            else if (map[(*x) + 1][*y] == 2 && map[*x][*y] == 7 && map[(*x) + 2][*y] == 3)
            {
                map[*x][*y] = 3;
                map[(*x) + 1][*y] = 4;
                map[(*x) + 2][*y] = 5;
                ++*x;
            }
            else if (map[(*x) + 1][*y] == 2 && map[*x][*y] == 4 && map[(*x) + 2][*y] == 3)
            {
                map[*x][*y] = 0;
                map[(*x) + 1][*y] = 4;
                map[(*x) + 2][*y] = 5;
                ++*x;
            }
            else if (map[(*x) + 1][*y] == 5 && map[*x][*y] == 7 && map[(*x) + 2][*y] == 3)
            {
                map[*x][*y] = 3;
                map[(*x) + 1][*y] = 7;
                map[(*x) + 2][*y] = 5;
                ++*x;
            }
            else if (map[(*x) + 1][*y] == 5 && map[*x][*y] == 4 && map[(*x) + 2][*y] == 0)
            {
                map[*x][*y] = 0;
                map[(*x) + 1][*y] = 7;
                map[(*x) + 2][*y] = 2;
                ++*x;
            }
            else if (map[(*x) + 1][*y] == 5 && map[*x][*y] == 4 && map[(*x) + 2][*y] == 3)
            {
                map[*x][*y] = 0;
                map[(*x) + 1][*y] = 7;
                map[(*x) + 2][*y] = 5;
                ++*x;
            }
        }
        break;
    case 'A':
    case 'a':  
    case 37://向左走
        {
            if (map[*x][(*y) - 1] == 0 && map[*x][*y] == 4)
            {
                map[*x][*y] = 0;
                map[*x][(*y) - 1] = 4;
                --*y;
            }
            else if (map[*x][(*y) - 1] == 0 && map[*x][*y] == 7)
            {
                map[*x][*y] = 3;
                map[*x][(*y) - 1] = 4;
                --*y;
            }
            else if (map[*x][(*y) - 1] == 3 && map[*x][*y] == 7)
            {
                map[*x][*y] = 3;
                map[*x][(*y) - 1] = 7;
                --*y;
            }
            else if (map[*x][(*y) - 1] == 3 && map[*x][*y] == 4)
            {
                map[*x][*y] = 0;
                map[*x][(*y) - 1] = 7;
                --*y;
            }
            else if (map[*x][(*y) - 1] == 0 && map[*x][*y] == 7)
            {
                map[*x][*y] = 3;
                map[*x][(*y) - 1] = 4;
                --*y;
            }
            else if (map[*x][(*y) - 1] == 2 && map[*x][*y] == 4 && map[*x][(*y) - 2] == 0)
            {
                map[*x][*y] = 0;
                map[*x][(*y) - 1] = 4;
                map[*x][(*y) - 2] = 2;
                --*y;
            }
            else if (map[*x][(*y) - 1] == 2 && map[*x][*y] == 7 && map[*x][(*y) - 2] == 0)
            {
                map[*x][*y] = 3;
                map[*x][(*y) - 1] = 4;
                map[*x][(*y) - 2] = 2;
                --*y;
            }
            else if (map[*x][(*y) - 1] == 2 && map[*x][*y] == 7 && map[*x][(*y) - 2] == 3)
            {
                map[*x][*y] = 3;
                map[*x][(*y) - 1] = 4;
                map[*x][(*y) - 2] = 5;
                --*y;
            }
            else if (map[*x][(*y) - 1] == 2 && map[*x][*y] == 4 && map[*x][(*y) - 2] == 3)
            {
                map[*x][*y] = 0;
                map[*x][(*y) - 1] = 4;
                map[*x][(*y) - 2] = 5;
                --*y;
            }
            else if (map[*x][(*y) - 1] == 5 && map[*x][*y] == 7 && map[*x][(*y) - 2] == 3)
            {
                map[*x][*y] = 3;
                map[*x][(*y) - 1] = 7;
                map[*x][(*y) - 2] = 5;
                --*y;
            }
            else if (map[*x][(*y) - 1] == 5 && map[*x][*y] == 4 && map[*x][(*y) - 2] == 0)
            {
                map[*x][*y] = 0;
                map[*x][(*y) - 1] = 7;
                map[*x][(*y) - 2] = 2;
                --*y;
            }
            else if (map[*x][(*y) - 1] == 5 && map[*x][*y] == 4 && map[*x][(*y) - 2] == 3)
            {
                map[*x][*y] = 0;
                map[*x][(*y) - 1] = 7;
                map[*x][(*y) - 2] = 5;
                --*y;
            }
        }
        break;
    case 'D':
    case 'd':  
    case 39://向右走
    {
        if (map[*x][(*y) + 1] == 0 && map[*x][*y] == 4)
        {
            map[*x][*y] = 0;
            map[*x][(*y) + 1] = 4;
            ++*y;
        }
        else if (map[*x][(*y) + 1] == 0 && map[*x][*y] == 7)
        {
            map[*x][*y] = 3;
            map[*x][(*y) + 1] = 4;
            ++*y;
        }
        else if (map[*x][(*y) + 1] == 3 && map[*x][*y] == 7)
        {
            map[*x][*y] = 3;
            map[*x][(*y) + 1] = 7;
            ++*y;
        }
        else if (map[*x][(*y) + 1] == 3 && map[*x][*y] == 4)
        {
            map[*x][*y] = 0;
            map[*x][(*y) + 1] = 7;
            ++*y;
        }
        else if (map[*x][(*y) + 1] == 0 && map[*x][*y] == 7)
        {
            map[*x][*y] = 3;
            map[*x][(*y) + 1] = 4;
            ++*y;
        }
        else if (map[*x][(*y) + 1] == 2 && map[*x][*y] == 4 && map[*x][(*y) + 2] == 0)
        {
            map[*x][*y] = 0;
            map[*x][(*y) + 1] = 4;
            map[*x][(*y) + 2] = 2;
            ++*y;
        }
        else if (map[*x][(*y) + 1] == 2 && map[*x][*y] == 7 && map[*x][(*y) + 2] == 0)
        {
            map[*x][*y] = 3;
            map[*x][(*y) + 1] = 4;
            map[*x][(*y) + 2] = 2;
            ++*y;
        }
        else if (map[*x][(*y) + 1] == 2 && map[*x][*y] == 7 && map[*x][(*y) + 2] == 3)
        {
            map[*x][*y] = 3;
            map[*x][(*y) + 1] = 4;
            map[*x][(*y) + 2] = 5;
            ++*y;
        }
        else if (map[*x][(*y) + 1] == 2 && map[*x][*y] == 4 && map[*x][(*y) + 2] == 3)
        {
            map[*x][*y] = 0;
            map[*x][(*y) + 1] = 4;
            map[*x][(*y) + 2] = 5;
            ++*y;
        }
        else if (map[*x][(*y) + 1] == 5 && map[*x][*y] == 7 && map[*x][(*y) + 2] == 3)
        {
            map[*x][*y] = 3;
            map[*x][(*y) + 1] = 7;
            map[*x][(*y) + 2] = 5;
            ++*y;
        }
        else if (map[*x][(*y) + 1] == 5 && map[*x][*y] == 4 && map[*x][(*y) + 2] == 0)
        {
            map[*x][*y] = 0;
            map[*x][(*y) + 1] = 7;
            map[*x][(*y) + 2] = 2;
            ++*y;
        }
        else if (map[*x][(*y) + 1] == 5 && map[*x][*y] == 4 && map[*x][(*y) + 2] == 3)
        {
            map[*x][*y] = 0;
            map[*x][(*y) + 1] = 7;
            map[*x][(*y) + 2] = 5;
            ++*y;
        }
    }
        break;
    }
}
void game()  //游戏实现函数
{
    int i = 0;
    int x = 0;
    int y = 0;
    system("cls");
    struct MAP *pmap = NULL; 
    printf("\n\n\t目前总共有%d关,你要从哪一关开始玩?:>>>\n", NUM-1);
    printf("\n\n\n\t\t\t\t\t\t\t按0返回主菜单<<<\n");
    scanf("%d", &i); 
    if(i==0)
    {
    	system("cls");
    	main();
	}
	else
	{
		 pmap = all_map + i - 1;
    find_man(pmap->map, &(pmap->row), &(pmap->col), &x, &y);
    while (1)
    {
        system("cls");
        char ch;
        print_map(pmap->map, &(pmap->row), &(pmap->col));
        player_act(pmap->map, &x, &y);
        if (is_win(pmap->map, &(pmap->row), &(pmap->col)) && i < NUM)
        {
            system("cls");
            print_map(pmap->map, &(pmap->row), &(pmap->col));
            system("cls");
            qinzhu();
            printf("\n");
            printf("\t\t\t\t你真棒,小伙子");
            printf("--你已经完成了第%d关\n\n\n\n",i);
			printf("\t\t\t\t输入1,重新选关卡\n");
            printf("\t\t\t\t输入2,返回主菜单\n");
            printf("\t\t\t完成后,按任意键到下一关\n");
			printf("\n");
            ch=getch();
            if(ch=='2')
            {
            	system("cls");
            	main();
            	break;
			}
			else if(ch=='1')
            {
            	system("cls");
            	game();	
            	break;
			}
            pmap++;
            x = 0;
            y = 0;
            i++;
            find_man(pmap->map, &(pmap->row), &(pmap->col), &x, &y);
        }
        else if (i == NUM)
        {
            printf("\n通关了啊!你真厉害!\n");
            return;
        }
    } 
	}
}
void jsao()  //游戏实现函数
{
    system("cls");
    printf("\n\n\n");
    printf("\t\t18级计算机科学与技术二班-------第六组\n\n\n");
    printf("\t指导老师:");
    printf("\t\t***\n");
    printf("\n");
    printf("\t参与人员:\n");
    printf("\t\t\t\t***---代码编写\n\n");
    printf("\t\t\t\t\t\tQQ:135****33\n");
    printf("\n");
    printf("\t\t\t\t***---流程图制作\n\n");
    printf("\t\t\t\t\t\tQQ:135****630\n");
    printf("\n");
    printf("\t\t\t\t***---文件总结\n\n");
    printf("\t\t\t\t\t\tQQ:175****49\n");
    printf("\n\n\n\n\n\n\n\n\t\t\t\t\t\t按任意键返回上一步"); 
	getch();
	system("cls");
	main();      
}
void qinzhu()//通过关卡之后对自己的奖励
{
	int n,m,i,j;
	for(i=1;i<=5;i++)
	{
		printf("\t\t\t*");
		printf("\t");
		printf("*");
		if(i%2!=0)
			printf("*");
		else
			printf(" ");
		if(i%2!=0)
			printf("*");
		else
			printf(" ");
		printf("*");	
		if(i==2)
		{
			printf("\t\t\t\t");
			for(j=0;j<15;j++)
				printf("*"); 
		}
		if(i==4)
		{
			printf("\t\t\t\t");
			for(j=0;j<15;j++)
				printf("*"); 
		}
		printf("\n");
	}	
	
    
}
void color()//运行界面颜色的选择
{
	int a,b;
	system("color 04");//改变颜色后面的数字,选择不一样的颜色
}

发布了67 篇原创文章 · 获赞 39 · 访问量 2705

猜你喜欢

转载自blog.csdn.net/qq_44859533/article/details/99647202