问题标题: 酷町堂:安全的大冒险(强行改良版)

0
0
已解决
廖睿轩
廖睿轩
新手光能
新手光能
#include<iostream>
#include<cstdio>
#include<bits/stdc++.h> 
#include<windows.h>
using namespace std;
int main(){
    int a;
    cout<<"                                                   安全的 大冒险\n";
    cout<<"                                                     任意键开始";
    cin>>a;
    Sleep(1000);
    system("cls");
    cout<<"                                             注意自我保护,谨防受骗上当\n适度游戏益脑,沉迷游戏伤身\n合理安排时间,享受健康生活\n";
    Sleep(1000);
    system("cls");
    cout<<"                                                        加载中\n";
    for(int i=1;i<=100;i+=){
        Sleep(100);
        cout<<加载中;
    }
    system("cls");
    cout<<"                                                  第一章 人间难\n";
    Sleep(100);
    cout<<"   你叫诺贝,是赤石大陆的一个人\n";
    Sleep(100);
    cout<<"   别人天天欺负你,\n今天,\n你来到赤石大陆上的圣地,掣朔,\n你打算寻找神  — 痨疤\n";
    Sleep(100);
    cout<<"但今天十分诡异,\n掣朔空无一人\n";
    cout<<"任意键继续";
    cin>>a;
    system("cls");
    while(1){
        Sleep(200);
        cout<<"_________________\n";
        Sleep(200);
        cout<<"|            OMO |\n";
        Sleep(200);
        cout<<"|   |   |   |    |\n";
        Sleep(200);
        cout<<"|   |   |   |    |\n";
        Sleep(200);
        cout<<"|                |\n";
        Sleep(200);
        cout<<"|你              |\n";
        Sleep(200);
        cout<<"|________________|\n1.干了它 2.叫来保洁阿姨\n";
        Sleep(200);
        cin>>a;
        if(a==1){
        system("cls");
        cout<<"_________________\n";
        cout<<"|                |\n";
        cout<<"|   |   |   |OMO |\n";
        cout<<"|   |   |   |    |\n";
        cout<<"|                |\n";
        cout<<"|             你 |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls");
        cout<<"_________________\n";
        cout<<"|            OMO |\n";
        cout<<"|   |   |   |  你|\n";
        cout<<"|   |   |   |    |\n";
        cout<<"|                |\n";
        cout<<"|                |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls");
        cout<<"_________________\n";
        cout<<"|                |\n";
        cout<<"|   |   |   |  你|\n";
        cout<<"|   |   |   |    |\n";
        cout<<"|                |\n";
        cout<<"|                |\n";
        cout<<"|________________|\n";
        Sleep(200);
        cout<<"O";
        Sleep(200);
        cout<<"M";
        Sleep(200);
        cout<<"O";
        Sleep(200);
        cout<<"香";
        Sleep(200);
        cout<<"不";
        Sleep(200);
        cout<<"香";
        system("cls");
        }
        else{
        system("cls");
        cout<<"保洁阿姨睡了,看来你要自己解决了\n";
        cout<<"忽然,一声尖叫,你该怎么做\n1.去看看 2.你没得选";
        cin>>a; 
        cout<<"你眼前倒着一个女人\n";
        Sleep(1000);
        system("cls");
        cout<<"_________________\n";
        Sleep(1000);
        cout<<"|                |\n";
        Sleep(1000);
        cout<<"|        你      |\n";
        Sleep(1000);
        cout<<"|    |女人   |   |\n";
        Sleep(1000);
        cout<<"|    |       |   |\n";
        Sleep(1000);
        cout<<"|                |\n";
        Sleep(1000);
        cout<<"|________________|\n";
        Sleep(1000);
        cout<<"女人爬了起来,你死了!\n";
        Sleep(1000);
        system("cls"); 
        cout<<"_________________\n";
        cout<<"|                |\n";
        cout<<"|        你      |\n";
        cout<<"|    |女人   |   |\n";
        cout<<"|    |       |   |\n";
        cout<<"|                |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls"); 
        cout<<"_________________\n";
        cout<<"|     女人       |\n";
        cout<<"|                |\n";
        cout<<"|    |       |   |\n";
        cout<<"|    |       |   |\n";
        cout<<"|                |\n";
        cout<<"|________________|\n";
        system("cls");
        break; 
        }
    } 
    while(1){
        cout<<"这是哪?";
        system("cls");
        Sleep(150);
        cout<<"第一层地狱";
        Sleep(150);
        cout<<"拔舌地狱";
        system("cls");
        cout<<"         第二章 十八层地狱";
        Sleep(1000) ;
        system("cls");
        cout<<"         第一层地狱 拔舌地狱\n";
        cout<<"你现在要做什么\n1.逃跑 2.接受惩罚 ";
        cin>>a;
        if(a==1){
            system("cls");
            cout<<"_________________\n";
            cout<<"|     死神       |\n";
            cout<<"|    ______      |\n";
            cout<<"|    |  你  |    |\n";
            cout<<"|    |______|    |\n";
            cout<<"|                |\n";
            cout<<"|________________|\n";
            Sleep(1000);
            system("cls"); 
            cout<<"_________________\n";
            cout<<"|     死神       |\n";
            cout<<"|    ______      |\n";
            cout<<"|    |  你       |\n";
            cout<<"|    |______     |\n";
            cout<<"|   我不做人了   |\n";
            cout<<"|________________|\n";
            Sleep(1000);
            system("cls"); 
            cout<<"_________________\n";
            cout<<"|          死神  |\n";
            cout<<"|    ______      |\n";
            cout<<"|    |     你    |\n";
            cout<<"|    |______     |\n";
            cout<<"|                |\n";
            cout<<"|________________|\n";
          Sleep(1000);
            system("cls"); 
            cout<<"_________________\n";
            cout<<"|                |\n";
            cout<<"|    ______      |\n";
            cout<<"|    |    你 死神|\n";
            cout<<"|    |______     |\n";
            cout<<"|                |\n";
            cout<<"|________________|\n";
            Sleep(1000);
            system("cls"); 
            cout<<"_________________\n";
            cout<<"|                |\n";
            cout<<"|    ______      |\n";
            cout<<"|    |       死神|\n";
            cout<<"|    |______     |\n";
            cout<<"|                |\n";
            cout<<"|________________|\n";
            Sleep(1000);
            system("cls");
            cout<<"你死了";    
        } 
        else{
        system("cls");
        cout<<"历经300000万天,你仍未离开拔舌地狱\n1.反抗 2.挖地洞";
        cin>>a;
        if(a==1){
        system("cls"); 
        cout<<"_________________\n";
        cout<<"|     死神       |\n";
        cout<<"|    ______      |\n";
        cout<<"|    |  你       |\n";
        cout<<"|    |______     |\n";
        cout<<"|   我不做人了   |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls"); 
        cout<<"_________________\n";
        cout<<"|          死神  |\n";
        cout<<"|    ______      |\n";
        cout<<"|    |     你    |\n";
        cout<<"|    |______     |\n";
        cout<<"|                |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls"); 
        cout<<"_________________\n";
        cout<<"|                |\n";
        cout<<"|    ______      |\n";
        cout<<"|    |    你 死神|\n";
        cout<<"|    |______     |\n";
        cout<<"|                |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls"); 
        cout<<"_________________\n";
        cout<<"|                |\n";
        cout<<"|    ______      |\n";
        cout<<"|    |       死神|\n";
        cout<<"|    |______     |\n";
        cout<<"|                |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls");
        cout<<"你死了";    
    } 
    if(a==2){
        system("cls");
        cout<<"_________________\n";
        cout<<"|     死神       |\n";
        cout<<"|    ______      |\n";
        cout<<"|    |  你  |    |\n";
        cout<<"|    |______|    |\n";
        cout<<"|                |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls");
        cout<<"_________________\n";
        cout<<"|     死神       |\n";
        cout<<"|    ______      |\n";
        cout<<"|    |  你▇|    |\n";
        cout<<"|    |______|    |\n";
        cout<<"|                |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls");
        cout<<"_________________\n";
        cout<<"|     死神       |\n";
        cout<<"|    ______      |\n";
        cout<<"|    |    ▇|    |\n";
        cout<<"|    |______|    |\n";
        cout<<"|                |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls");
        cout<<"_________________\n";
        cout<<"|     死神       |\n";
        cout<<"|    ______      |\n";
        cout<<"|    |    ▇|    |\n";
        cout<<"|    |______|    |\n";
        cout<<"|  别跑          |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls"); 
        cout<<"_________________\n";
        cout<<"|          死神  |\n";
        cout<<"|    ______      |\n";
        cout<<"|    |   ▇|     |\n";
        cout<<"|    |_____|     |\n";
        cout<<"|                |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls"); 
        cout<<"_________________\n";
        cout<<"|                |\n";
        cout<<"|    ______      |\n";
        cout<<"|    |    ▇ 死神|\n";
        cout<<"|    |______     |\n";
        cout<<"|  居然有个洞    |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls"); 
        cout<<"_________________\n";
        cout<<"|                |\n";
        cout<<"|    ______      |\n";
        cout<<"|    |    ▇     |\n";
        cout<<"|    |______     |\n";
        cout<<"|                |\n";
        cout<<"|________________|\n";
        Sleep(1000);
        system("cls");
        cout<<"\n\n\n\n\n\n\n\n";
        cout<<"死神                你\n";
        cout<<"_______________________________________________";
        Sleep(1000);
        cout<<"按任意键逃跑";
        cin>>a;
        Sleep(1000);
        system("cls");
        cout<<"\n\n\n\n\n\n\n\n";
        cout<<"  死神              你\n";
        cout<<"_______________________________________________";
        Sleep(1000);
        system("cls");
        cout<<"\n\n\n\n\n\n\n\n";
        cout<<"      死神          你\n";
        cout<<"_______________________________________________";
        Sleep(1000);
        system("cls");
        cout<<"\n\n\n\n\n\n\n\n";
        cout<<"          死神      你\n";
                        cout<<"_______________________________________________";
                        Sleep(1000);
                        system("cls");
                        cout<<"\n\n\n\n\n\n\n\n";
                        cout<<"             死神   你\n";
                        cout<<"_____________去死吧____________________________";
                        Sleep(1000);
                        if(a>5&&a<10){ 
                            system("cls");
                            cout<<"\n\n\n\n\n\n\n\n";
                            cout<<"             死神     \n";
                            cout<<"_____________哈哈哈____________________________"; 
                        }
                        else{
                            Sleep(1000);
                            system("cls");
                            cout<<"\n\n\n\n\n\n\n\n";
                            cout<<"             死神      你                     ▇\n";
                            cout<<"_____________逃离之门出现了!__________________";
                            Sleep(1000);
                            system("cls");
                            cout<<"\n\n\n\n\n\n\n\n";
                            cout<<"             死神           你                ▇\n";
                            cout<<"_______________________________________________";
                            Sleep(1000);
                            system("cls");
                            cout<<"\n\n\n\n\n\n\n\n";
                            cout<<"             死神                 你          ▇ \n";
                            cout<<"_______________________________________________";
                            Sleep(1000);
                            system("cls");
                            cout<<"\n\n\n\n\n\n\n\n";
                            cout<<"             死神                       你    ▇\n";
                            cout<<"_______________________________________________";
                            Sleep(1000);
                            system("cls");
                            cout<<"\n\n\n\n\n\n\n\n";
                            cout<<"             死神                           \n";
                            cout<<"_______________________________________________";
                            system("cls");
                            Sleep(100);
                            cout<<"恭";
                            Sleep(100);
                            cout<<"喜";
                            Sleep(100);
                            cout<<"通";
                            Sleep(100);
                            cout<<"关";
                            system
                            cin>>a; 
                }   
            }
        }
    } 
}                 

 


0
已采纳
包涵宇
包涵宇
中级天翼
中级天翼

太垃圾了吧

不过也没事,所有人不都是这样过来的吗?

先要快速提升,可以借鉴一下我的代码。。。

/*
■
□
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
0=黑色,1=蓝色,2=绿色,3=湖蓝色,4=红色,5=紫色;

6=黄色,7=白色,8=灰色,9=淡蓝色,A=淡绿色,B=浅绿色;

C=淡红色,D=淡紫色,E=淡黄色,F=亮白色。
VK_LBUTTON             鼠标左键                      0x01
VK_RBUTTON             鼠标右键                      0x02
VK_CANCEL              Ctrl + Break                  0x03
VK_MBUTTON             鼠标中键                      0x04

VK_BACK                Backspace 键       0x08
VK_TAB                 Tab 键                        0x09

VK_RETURN              回车键                        0x0D


VK_SHIFT               Shift 键                      0x10
VK_CONTROL             Ctrl 键                       0x11
VK_MENU                Alt 键                 0x12
VK_PAUSE               Pause 键                      0x13
VK_CAPITAL             Caps Lock 键                  0x14

VK_ESCAPE              Esc 键                        0x1B

VK_SPACE               空格键         0x20
VK_PRIOR               Page Up 键                    0x21
VK_NEXT                Page Down 键                  0x22
VK_END                 End 键                        0x23
VK_HOME                Home 键                       0x24
VK_LEFT                左箭头键                      0x25
VK_UP                  上箭头键                      0x26
VK_RIGHT               右箭头键                      0x27
VK_DOWN                下箭头键                      0x28
VK_SNAPSHOT            Print Screen 键               0x2C
VK_Insert              Insert 键                     0x2D
VK_Delete              Delete 键                     0x2E

'0' – '9'             数字 0 - 9                    0x30 - 0x39
'A' – 'Z'             字母 A - Z                    0x41 - 0x5A

VK_LWIN                左WinKey(104键盘才有)         0x5B
VK_RWIN                右WinKey(104键盘才有)         0x5C
VK_APPS                AppsKey(104键盘才有)          0x5D

VK_NUMPAD0            小键盘 0 键                    0x60
VK_NUMPAD1            小键盘 1 键                    0x61
VK_NUMPAD2            小键盘 2 键                    0x62
VK_NUMPAD3            小键盘 3 键                    0x63
VK_NUMPAD4            小键盘 4 键                    0x64
VK_NUMPAD5            小键盘 5 键                    0x65
VK_NUMPAD6            小键盘 6 键                    0x66
VK_NUMPAD7            小键盘 7 键                    0x67
VK_NUMPAD8            小键盘 8 键                    0x68
VK_NUMPAD9            小键盘 9 键                    0x69

VK_F1 - VK_F24        功能键F1 – F24               0x70 - 0x87

VK_NUMLOCK            Num Lock 键                   0x90
VK_SCROLL             Scroll Lock 键                0x91
#include <iostream>
#include "windows.h"
using namespace std;

int main()
{
    cout << "原色testCOLOR(没有设置字体颜色)" << endl;
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |
        FOREGROUND_GREEN | FOREGROUND_BLUE);//设置三色相加
    cout << "白色testCOLOR(红色绿色蓝色相加)" << endl;
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
    //设置红色
    cout << "红色testCOLOR(设置的颜色为红色)" << endl;
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN)
        ;//设置绿色
    cout << "绿色testCOLOR(设置的颜色为绿色)" << endl;
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
    //设置蓝色
    cout << "蓝色testCOLOR(设置的颜色为蓝色)" << endl;
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |
        FOREGROUND_GREEN);//设置红色和绿色相加
    cout << "黄色testCOLOR(红色和绿色相加色)" << endl;
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |
        FOREGROUND_BLUE);//设置红色和蓝色相加
    cout << "粉色testCOLOR(红色和蓝色相加色)" << endl;
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN |
        FOREGROUND_BLUE);//设置绿色和蓝色相加
    cout << "青色testCOLOR(绿色和蓝色相加色)" << endl;
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
    //设置颜色,没有添加颜色,故为原色
    cout << endl;

    system("pause");
    return 0;
}
*/ 
#include<bits/stdc++.h>
#include<time.h>
#include<windows.h>
#include<conio.h>
#include<cstdio>
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)
#define get(VK_NONAME) (GetAsyncKeyState(VK_NONAME))
#define clean (system("cls"))
#define sl(x) (Sleep(x))
//格式1:上次游玩得分 最高得分 
//格式2: 上次日期(年月日) 上次游玩累计时间(分钟) {以后建} 
//地图 :7*100    0:空   1,正常方块   
//△:你 
//×:危险方块 
using namespace std;
int kais,zg,chose;
HWND hwnd=GetForegroundWindow();
int zgt;
int x,y,er=-5,jl,erc,jlc; 
int df;
int dt[7][100]={
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1},
{0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1},
{0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1},
{1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,1,0,0,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,0,1,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,0,1,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,0,1,1,1,1,0,0,1,1,0,0,1,1,1},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}
};
void cls(){//特别感谢五年长久 
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD coordScreen = { 0, 0 };
    SetConsoleCursorPosition( hConsole, coordScreen );
}
void HideCursor(){
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO CursorInfo;
    GetConsoleCursorInfo(handle, &CursorInfo);
    CursorInfo.bVisible = false;
    SetConsoleCursorInfo(handle, &CursorInfo);
}
void out(string s){
    for(int i=0;i<s.size();i++){
        cout<<s[i];
        Sleep(40);
    }
    cout<<"\n";   
}
void quicklyout(string s){
    for(int i=0;i<s.size();i++){
        cout<<s[i];
        Sleep(20);
    }
    cout<<"\n";
}
void getz(){
    while(1){
        if(get(0x5A)){
            clean;
            break;
        }
    }
}
void goin(){
    system("mode con cols=50 lines=10");  
    out("你的面前\n只剩下最后的超新星爆炸后的残骸\n一切都无限接近绝对零度......\n\n按Z继续\n");
    getz();
    out("你正在叹息时,二维空间忽然坍塌向三维空间坍塌了!\n于是......\n你开始了逃亡......\n\n按Z继续\n");
    getz();
}
int change(string s){
    int f=1,idx=0;
    for(int i=s.size()-1;i>=0;i--){
        idx+=(s[i]-'0')*f;
        f*=10;
    }
    return idx;
}           
void getkz(){//摘自luckyone906的博客 
    ifstream fin("1.txt");
    fin>>y>>x>>er>>zg;
    fin.close();
    if(y==0&&x==0&&er==0&&zg==0){
        er=-5;
        x=4;
        y=0;
    }
}
void prin(){
    cls();
    cout<<"      得分"<<left << setw(6) << zgt<<"\n";
    for(int i=0;i<=6;i++){
        for(int j=y-5;j<=-1;j++){
            if(j<=er){
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
                cout<<"×";    
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
            }
            else{
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
                cout<<"■";
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
            }
        }
        for(int j=max(0,y-5);j<=min(99,y+5);j++){
            if(j<=er){
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
                cout<<"×";    
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
            }
            else if(x==i&&y==j){
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
                cout<<"△";
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
            }
            else if(dt[i][j]==0)cout<<"□";
            else{
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
                cout<<"■";
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
            }
        }
        cout<<"\n";
    }
}
void shiyong(){
    out("操作须知:\n按A/D左右选择,按Z确认选择。\n按X结束游戏。\n按左箭头键/右箭头键左右移动,按上箭头键跳跃。\n△:你   ×:危险方块  ■普通方块\n\n按Z继续\n");
    getz();
}
void mainchose(){
    zg=max(zg,zgt);
    chose=1;
    int tf=1;
    while(1){
        if(get(0x5A))break;
        bool f=0;
        if(tf==1){
            tf=0;
            f=1;
        }
        if(get(0x41)){
            if(chose==2){
                chose=1;
                f=1;
            }
        }
        if(get(0x44)){
            if(chose==1){
                chose=2;
                f=1;
            }
        }
        if(f==1&&chose==1){
            clean;
            cout<<"---------------------------------\n"
                <<"|         最高分:"<< left << setw(6) << zg<<"        |\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
            cout<<"------------------";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
            cout<<"---------------\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
            cout<<"|  继续上次游戏  |";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
            cout<<"    新 游 戏  |\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
            cout<<"------------------";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
            cout<<"---------------\n";
        }
        if(f==1&&chose==2){
            clean;
            cout<<"---------------------------------\n"
                <<"|         最高分:"<< left << setw(6) << zg<<"        |\n";
            cout<<"-----------------";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
            cout<<"----------------\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
            cout<<"|  继续上次游戏  ";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
            cout<<"|    新 游 戏  |\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
            cout<<"-----------------";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
            cout<<"----------------\n";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
        }
        sl(10);
    } 
}
int choseagain(){
    int chosea=1,tf=1;
    while(1){
        if(get(0x5A))break;
        bool f=0;
        if(tf==1){
            tf=0;
            f=1;
        }
        if(get(0x41)){
            if(chosea==2){
                chosea=1;
                f=1;
            }
        }
        if(get(0x44)){
            if(chosea==1){
                chosea=2;
                f=1;
            }
        }
        if(f==1&&chosea==1){
            clean;
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
            cout<<"   yes   ";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
            cout<<"   no";
        }
        if(f==1&&chosea==2){
            clean;
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
            cout<<"   yes   ";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
            cout<<"   no";
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
        }
        sl(10);
    } 
    return chosea;
}
void goout(int x){
    if(x==1){//摘自 浅浅的的微博 
        ofstream fout("1.txt");
        fout<<0<<" "<<4<<" "<<-5<<" "<<max(zg,zgt);
        /*fout << flush;*/ fout.close();
    }
    else{
        freopen("1.txt","w",stdout);
        cout<<y<<" "<<x<<" "<<er<<" "<<max(zg,zgt);
        fclose(stdout);
    }
}
void Main1(){
    /*cout<<"---------------------------------\n"
        <<"|         最高分:"<< left << setw(6) << zg<<"        |\n"
        <<"---------------------------------\n"
        <<"|  继续上次游戏  |    新 游 戏  |\n"
        <<"---------------------------------\n";*/
    getkz();
    sl(1000);
    erc=0;
    jlc=0;
    mainchose();
    if(chose==2){
        er=-5;
        x=4;
        y=0;
    }
    clean;
    zgt=0;
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
    out("        3");
    sl(1000);
    clean;
    out("        2");
    sl(1000);
    clean;
    out("        1");
    sl(1000);
    clean;
    out("      开始!");
    sl(500);
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
    int yf;
    prin();
    while(1){
        zgt=max(zgt,y);
        df=y;
        if(get('X')){
            yf=2;
            //goout();
            break;
        }
        if(y<=er){
            yf=0;
            break;
        }
        erc++;
        if(dt[x+1][y]==0)jlc++;
        if(erc==10){
            er++;
            erc=1;
            prin();
        }
        if(y==98&&x==4){
            yf=1;
            break;
        }
        if(x==6){
            x++;
            sl(100);
            prin();
            sl(100);
            clean;
            yf=-1;
            break;
        }
        if(dt[x+1][y]==0&&jlc==4){
            x++;
            jlc=0;
            prin();
        }
        if(get(0x25)&&dt[x][y-1]==0){
            y--;
            prin();
        }
        if(dt[x+1][y]==1&&get(0x26)){
            int jian;
            for(jian=1;jian<=6-x;jian++){
                if(dt[x-jian][y]==1){
                    jian--;
                    break;
                }
            }
            x-=jian;
            x=max(x,0);
            prin();
        }
        if(get(0x27)&&dt[x][y+1]==0){
            y++;
            prin();
        }
        sl(50);
        /*VK_LEFT                左箭头键                      0x25
        VK_UP                  上箭头键                      0x26
        VK_RIGHT               右箭头键                      0x27
        VK_DOWN                下箭头键                      0x28*/
    }
    if(yf==-1){
        out("你掉入了虚空......");
        sl(1000); 
        goout(1);
        clean;
        out("要再来一次吗?");
        if(choseagain()==1){
            sl(500); 
            Main1();
        }
        else{
            clean;
            cout<<"再会!"; 
            sl(500);
            ShowWindow(hwnd,0); 
            return ;
        }
    }
    else if(yf==0){
        clean;
        out("你被二维化了......") ;
        goout(1);
        sl(1000); 
        clean;
        out("要再来一次吗?");
        if(choseagain()==1){
            sl(500); 
            Main1();
        }
        else{
            clean;
            cout<<"再会!"; 
            sl(500);
            ShowWindow(hwnd,0); 
            return ;
        }
    }
    else if(yf==1){
        sl(500);
        clean;
        out("你来到了宇宙的边缘\n忽然,你看到了一条裂缝......\n\n   (未完待续)");
        goout(1);
    }
    else{
        goout(2);
        ShowWindow(hwnd,0);
    }
}
int main(){
    HideCursor();
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
    goin();
    //getkz();
    shiyong();
    sl(500); 
    Main1();
    return 0;
}

这代码其实也很垃圾,只不过实现了区块染色罢了

PS:我也不想打击你,但你的代码能力的确是该提高了

可以看看网上的一些代码,那对你很有用!

0
王泽轩
王泽轩
资深天翼
资深天翼

第一章-->第二章有bug,进不去(太快了,一直闪频)

0
0
胡书柏
胡书柏
中级守护
中级守护

最近有神马游戏在打???

(我建议你出重置版)

0
我要回答