跳到正文

个人记录

New word game

whilethan1约 12 分钟
原文
文章信息与版本

文章信息

发布
2021年11月7日
收录
2026年2月4日
更新
2026年11月3日
篇幅
约 12 分钟

版本

  1. v2当前
  2. v1

DessertEscape(R)

C++
code

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
void GoToxy(int x,int y)
{
    COORD  coord;
    coord.X=x;
    coord.Y=y;
    HANDLE a=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(a,coord);
}
void HideCursor(){//隐藏光标CONSOLE_CURSOR_INFO结构体包含控制台光标的信息,DWORD dwSize光标百分比厚度(1~100)和BOOL bVisible光标是否可见
    CONSOLE_CURSOR_INFO cursor_info={1,0};
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info); //SetConsoleCursorInfo用来设置指定的控制台光标的大小和可见性。
}
void ShowCursor(){
    CONSOLE_CURSOR_INFO cursor_info={1,1};
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
}
void ColorChoose(int color)   //颜色选择函数
{
    switch(color)
    {
        case 1:               //天蓝色
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
        break;
        case 2:               //绿色
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
        break;
        case 3:               //黄色
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
        break;
        case 4:               //红色
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
        break;
        case 5:               //紫色
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
        break;
        case 6:               //白色
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
        break;
        case 7:               //深蓝色
        SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
        break;
    }
}
void ScreenPrint(int x,int y){
    system("cls");
    GoToxy(0,0);
    printf("+");
    for(int i=1;i<=y+1;i++)
        printf("-");
    printf("+");
    for(int i=1;i<=x-2;i++){
        GoToxy(0,i);
        printf("|");
        GoToxy(y+1,i);
        printf("|");
    }
    GoToxy(0,x-1);
    printf("+");
    for(int i=1;i<=y+1;i++)
        printf("-");
    printf("+");
    return ;
}
namespace GameThing{
    void Welcome_Screen(char FileName[],int x,int y){
        ifstream fin(FileName);
        int pnum;
        fin>>pnum;
        string xprint;
        for(int i=1;i<=pnum;i++){
            getline(fin,xprint);
            GoToxy((y-xprint.length())/2+1,x/2+1);
            cout<<xprint;
            GoToxy((y-xprint.length())/2+1,x/2+2);
            if(i==pnum){
                printf("StartGame...");
                GoToxy((y-xprint.length())/2+1,x/2+3);
                system("pause");
                system("cls");
                return ;
            }
            printf("Next...");
            system("pause");
            GoToxy(0,x/2+1);
            printf("|");
            for(int i=1;i<=y-2;i++) printf(" ");
            printf("|");
            GoToxy(0,x/2+2);
            printf("|");
            for(int i=1;i<=y+1;i++)
                printf(" ");
            printf("|");
        }
    }
    int Mx,My;
    int Level;
    int Xp;
    int alive_Day=0;
    bool is_Accpted[100];
    void StartMenu(){
        ScreenPrint(25,70);
        Mx=25,My=70;
        Level=0;
        alive_Day=0;
        Xp=0;
        Welcome_Screen("ItIsTheBegin.txt",25,70);
    }
}
int main(){
    using namespace GameThing;
    StartMenu();
    return 0;
}

/* txt [StoryLine] Network. 1-ItIsTheBegin

代码
  20

  [Where are me?]
  [Looks like I'm in a dessert.]
  [Water?]
  [Maybe I saw some water.]
  [There's a notebook.]
  <Open The book>
  >hi.
  >I lived here in the 2010s.
  >I know where are you.
  >Do you want to escape the dessert?
  >Maybe I can help you.
  >Now Iet's start the way.
  >Put any keys to continue...
  <You Close the book>
  >Yeah,Maybe I should listen to the person.
  >Start?
  >Start.
  >3
  >2
  >1

2-WhatIsTheRoad

代码
[Maybe I should start.]
[But where is the road?]
<You read the book again>
"Null"
"Null"
"Null"
"I know you want to find it.
"But"
"Swift hadpi tednyit Hasyited Maited"
"Slifer Quitehayip hiptted Nessagy"
"Thyi HMQ."
[What does it meaning?]
/choose A/B
A:find the key.
B:Losing wagetied,Haspited nessl.
C:Think about why you're here

[Choose A] 3-1-FindTheKey

代码
[It may be a hard work.]
[But you have direction now.]
<Open Map>
<Wait 15s>
<Wait 13s>
<Wait 7s>
<Wait __>
<begin.>
/begin_map

[Choose B] 3-2-Yep(3)

代码
>Welcome.
>Yep
"Welcome to the world"
*It is a special game
*You can change the way
*Even Storyline.
*Did you be ready for it?
/choose A/B
A:Yep
B:Yes

[Choose A] 3-2-1-Yep(4)

代码
 <Begin>
// a word game is really difficult to make
//...

[Choose B] 3-2-2-Wrong_Answer(4)

代码
 "You may not remember the string."
"We show it on the second line"
""
"Now you must know that.
"Welcome to the world."
"\\\/\\\\\////\\\\\"
"\ \  \  \   \ \ \    \   \"
"\\\\/\\///\\//\\\\////\\\////\\\///\\\\////\\\\//\"
"What does it meaning?
1)___
/choose A/B
A: Nevada
B: Nevede

[Choose C]

3-3-__A__t(3)

代码
 "Why you are here?"
/Input string
/print_file WhatIsTheRoad.txt_16
"Why you are here?"
/Input string
/Ifdef
/If_HAS_dream&
/If_HAS_is
"Yes.It a dream.
""
/Jump 3-FindTheKey.txt
/*彩蛋*/
原文