C/C++教程

真.“文字游戏”,献给热爱汉字的你[C++]

本文主要是介绍真.“文字游戏”,献给热爱汉字的你[C++],对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

前言:

       自从步入初中以来,学习任务是越来越重,每周还要去训练,实在是有些劳累。在学校,没有电脑,没有手机,没有漫画......一切都是那么无聊,那么乏味。唯一的消遣,也就只是看一些课外书了。也许是我学过几年书法吧,对汉字有着不同的感情。看着书上的汉字,他们好像全都有了生命一般。一竖一横,仿佛在诉说一种文化的传承;一撇一捺,又似乎在展现文化的生命......我着实是对汉字着迷(感觉好假),于是就爆肝写出了这款游戏。

奉上代码:

#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <conio.h>
#include "windows.h"
using std::cout;
int h1=0;
const int row = 26;
const int col = 18;
bool flag=true;
bool flag2=true;
int x = 1;
int y = 11;
int u=0;
int u1=0;
int x2=1;
int y2=1;
void caidan_caihongmao() {
    system("mode con cols=100 lines=100");
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"你走进了山洞"<<"\n";
    system("pause");
    system("cls");
    cout<<"里面竟然有..."<<"\n";
    system("pause");
    system("cls");
    /*第0行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"解锁成就:山洞里有...彩虹猫?"<<"\n";
    /*第1行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"           # # # # # # # # # # # # #  ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
    cout<<"~~~~~     ~~~~~     ~~~~~     "<<"\n";
    /*第2行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"         #                           #";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
    cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<"\n";
    /*第3行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"         #                           #";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
    cout<<"~~~~~"<<"\n";
    /*第4行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"         #                           #";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<"\n";
    /*第5行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"    ##   ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"#       ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"##                  ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"#";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
    cout<<"~~~~~"<<"\n";
    /*第6行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"    #  # ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"#     ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"#  #                  ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"#";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    cout<<"~~~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"# #";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    cout<<"~~~~~~~~~~~~~~~~~~~~"<<"\n";
    /*第7行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"    #   # # # #   #                  ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"#";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<" # # #    #";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    cout<<"~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
    cout<<"~~~~~"<<"\n";
    /*第8行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"   #               #                 ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"#         ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"#";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    cout<<"~~~~~~~~~~~~~~~~~~~~"<<"\n";
    /*第9行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<" #     ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    cout<<"#      #      ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"#               ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"#";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<" # # # #";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    cout<<"~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
    cout<<"~~~~~"<<"\n";
    /*第10行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<" #                   #               ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"#";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
    cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<"\n";
    /*第11行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"   #    ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    cout<<"|__|__|    ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"#                 ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"#";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"~~~~~";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
    cout<<"~~~~~"<<"\n";
    /*第12行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"     # # # # # # # ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"# # # # # # # # #  ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<"\n";
    /*第13行*/
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    cout<<"      # #     # #       # #     # #        ";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"~~~~~     ~~~~~     ~~~~~"<<"\n";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
    system("pause");
    system("cls"); 
    system("mode con cols=60 lines=30");
}
int liangliang() {
    system("cls");
    for(int i=1; i<=12; i++)
        printf("\n");
    for(int i=1; i<=26; i++)
        printf(" ");
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
    cout<<"你死了!"<<"\n";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    for(int i=1; i<=26; i++)
        printf(" ");
    system("pause");
    h1=1;
    return 0;
}
int tongguan() {
    system("cls");
    for(int i=1; i<=12; i++)
        printf("\n");
    for(int i=1; i<=26; i++)
        printf(" ");
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
    cout<<"通关!"<<"\n";
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
    for(int i=1; i<=26; i++)
        printf(" ");
    system("pause");
    h1=1;
    return 0;
}
int map[row][col] = {
    {7,7,7,7,7,7,7,7,6,6,6,7,7,0,0,0,0,0},
    {7,8,0,0,0,0,3,0,0,0,0,5,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,0,3,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,3,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0},
    {7,0,3,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,3,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,9,9,0},
    {7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,9,9,0},
    {7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,0,3,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,3,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,3,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
    {7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
    {7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0},
};
void draw() {
    int i;
    for (i = 0; i < row; i++) {
        for (int j = 0; j < col; j++) {
            switch (map[i][j]) {
                case 0: {
                    printf("  ");
                    break;
                }
                case 1: {
                    printf("鸟");
                    break;
                }
                case 2: {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_GREEN);
                    printf("河");
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
                    break;
                }
                case 3: {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
                    printf("树");
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
                    break;
                }
                case 5: {
                    if(flag)
                        printf("我");
                    if(!flag)
                        printf("鹅");
                    break;
                }
                case 6: {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
                    printf("洞");
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
                    break;
                }
                case 7: {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
                    printf("山");
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
                    break;
                }
                case 9: {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
                    printf("村");
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
                    break;
                }
                case 8: {
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
                    printf("忍");
                    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
                    break;
                }
            }
        }
        printf("\n");
    }
}
void rzmove() {
    map[x2][y2] = u1;
    if (x2>x&&map[x2-1][y2]!=3&&map[x2-1][y2]!=7&&map[x2-1][y2]!=1&&map[x2-1][y2]!=2) {
        x2-=1;
    }
    if (x2<x&&map[x2+1][y2]!=3&&map[x2+1][y2]!=7&&map[x2+1][y2]!=1&&map[x2+1][y2]!=2) {
        x2+=1;
    }
    if (y2<y&&map[x2][y2+1]!=3&&map[x2][y2+1]!=7&&map[x2][y2+1]!=1&&map[x2][y2+1]!=2) {
        y2+=1;
    }
    if (y2>y&&map[x2][y2-1]!=3&&map[x2][y2-1]!=7&&map[x2][y2-1]!=1&&map[x2][y2-1]!=2) {
        y2-=1;
    }
    u1=map[x2][y2];
    if(map[x2][y2]==5)
        liangliang();
    map[x2][y2] = 8;
 
//    draw();
}
void move(int _x, int _y) {
    if (map[x + _x][y + _y] == 2 || map[x + _x][y + _y] == 5) {
        if(flag)
            return;
    }
    if (map[x + _x][y + _y] == 9 ) {
        tongguan();
        return ;
    }
    if (map[x + _x][y + _y] == 7 || map[x + _x][y + _y] == 5) {
        return;
    }
    if(map[x+_x][y+_y]==3)
        return;
    if(map[x+_x][y+_y]==8)
        liangliang();
    if (map[x + _x][y + _y] == 1) {
        if (map[x + 2 * _x][y + 2 * _y] == 2) {
            return;
        }
        map[x + _x][y + _y] = 0;
        flag=false;
        move(_x, _y);
        return;
    }
    if(map[x+_x][y+_y]==6)
        caidan_caihongmao();
    map[x][y] = u;
    u=map[x+_x][y+_y];
    x += _x;
    y += _y;
    map[x][y] = 5;
//    draw();
}
void step(char o) {
    switch (o) {
        case 'w': {
            move(-1, 0);
            break;
        }
        case 's': {
            move(1, 0);
            break;
        }
        case 'd': {
            move(0, 1);
            break;
        }
        case 'a': {
            move(0, -1);
            break;
        }
    }
}
int main() {
    system("mode con cols=60 lines=30");
    for(int i=1; i<=12; i++)
        printf("\n");
    printf("              欢迎来到汉字的世界\n");
    system("pause");
    system("cls");
    for(int i=1; i<=12; i++)
        printf("\n");
    printf("旁白:你从汉字大师那里苦学六年本领,今天是你毕业的日子\n");
    system("pause");
    system("cls");
    for(int i=1; i<=12; i++)
        printf("\n");
    printf("旁白:来到这条熟悉的河前面,你已经可以看到你的家乡——汉字村了\n");
    system("pause");
    system("cls");
    for(int i=1; i<=12; i++)
        printf("\n");
    printf("旁白:突然,从远处杀出个忍者\n");
    system("pause");
    system("cls");
    for(int i=1; i<=12; i++)
        printf("\n");
    printf("旁白:赶快过河回村\n");
    system("pause");
    system("cls");
    for(int i=1; i<=12; i++)
        printf("\n");
    printf("提示:改变自己,会让你走得更远\n");
    system("pause");
    system("cls");
    while (true) {
        draw();
        step(_getch());
        rzmove();
        system("cls");
        if(h1)
            return 0;
    }
}
 

总结:

1.由于我使用课余时间写的此游戏,再加上本人技术一般般,所以游戏运行稍慢,还请见谅;

2.本人认为此游戏的难度一般,还请大家多多斧正;

3.本游戏有多个关卡,剧情连续,由于没有太多的时间所,以就只能一关一关来写(到寒假了,再   试着整合成一个代码);

最后:重要的事情说三遍:三连!三连!三连!

这篇关于真.“文字游戏”,献给热爱汉字的你[C++]的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!