(注:本人土豆编程帐号为土豆编程503313,算我二创,网址)
#include<iostream>
#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>
#include<direct.h>
#include<Windows.h>
#include<cstdlib>
#include<ctime>
#include<time.h>
#include<bits/stdc++.h>
using namespace std;
void centerwindow(RECT &rect, RECT &desktop)
{//使窗口移动到桌面居中位置
int width,height,dtWidth,dtHeight;
bool bSuccess=false;
HWND hwnd = GetDesktopWindow();
GetWindowRect(hwnd,&desktop);
dtWidth=desktop.right-desktop.left;
dtHeight=desktop.bottom-desktop.top;
hwnd = GetForegroundWindow();
GetWindowRect(hwnd,&rect);
width=rect.right-rect.left;
height=rect.bottom-rect.top;
bSuccess=MoveWindow(hwnd,(dtWidth-width)/2,(dtHeight-height)/2,width,height,true);
GetWindowRect(hwnd,&rect);
return ;
}
void HideCursor()//影藏光标
{
CONSOLE_CURSOR_INFO cursor_info = {1, 0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
void ShowCursor()//windows.h
{
CONSOLE_CURSOR_INFO cur={1,1};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cur);
}
void gotoxy_cover(int x, int y)//覆盖清屏 ,指定行列覆盖
{
COORD pos = {x,y};
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOut, pos);
return ;
}
void gotoxy_move(int x, int y)
{
COORD coord = {static_cast<SHORT>(x), static_cast<SHORT>(y)};
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hStdOut, coord);
}
int main()
{
int i,n;
for(int i=1;i<=100;i++)
{
cout<<"游戏资源“约翰的无限迷宫”正在检查更新中······"<<endl;
cout<<"目前加载进度:"<<i<<"%"<<endl;
if(i!=100)
{
Sleep(1);
system("CLS");
}
}
Sleep(1000);
srand((unsigned)time(NULL));
system("cls");
HideCursor();
wt:for(int a=0;a<101;a++)
{
printf("更新中(Loading in progress)... ...\n");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x09);
for(int b=0;b<a;b++)
{
printf("▌");
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x0F);
for(int c=100-a;c>0;c--)
{
printf("▌");
}
printf("\n");
printf("已更新 %d/100\n",a);
int randomnumber=rand()%100;
printf("大小:%d/MB\n",randomnumber);
randomnumber=rand()%10;
printf("预计剩余:%d.%d/s\n",10-a/10,randomnumber);
Sleep(50);
gotoxy_cover(0,0);//从0,0 覆盖
int de=rand()%80+1;
if(de==10)
{
int sse=MessageBox(NULL,"加载遇到问题!","Loading",MB_ABORTRETRYIGNORE|MB_ICONHAND);
if(sse==IDRETRY)goto wt;
if(sse==IDABORT)system("cls"),exit(1);
if(sse==IDIGNORE);
}
}
MessageBox(NULL,TEXT("加载完毕(Loading completed)"),TEXT("Loading"),MB_ICONINFORMATION);
system("cls");
printf("准备中... ...\n");
Sleep(3000);
Sleep(500);
system("cls");
srand((unsigned)time(NULL));
system("color 0F");
printf("游戏:约翰的无限迷宫\n");
Sleep(500);
printf("出品人:周子毅6200\n");
Sleep(500);
printf("版本:3.0\n");
Sleep(500);
printf("按ENTER(回车)键开始");
getchar();
system("cls");
printf("等待加载...\n0");
Sleep(500);
system("cls");
printf("准备加载...\n▊15");
Sleep(500);
system("cls");
printf("加载资源中...\n█▎25");
Sleep(500);
system("cls");
printf("加载资源中...\n██▊55");
Sleep(500);
system("cls");
printf("加载资源中...\n███▌70");
Sleep(500);
system("cls");
printf("加载资源中...\n███▊75");
Sleep(500);
system("cls");
printf("正在加载章节...\n████▌90");
Sleep(500);
system("cls");
printf("正在加载章节...\n█████100");
Sleep(500);
system("cls");
printf("正在进入游戏...\n█████100");
Sleep(500);
system("cls");
while(1)
{
system("cls");
printf("<更新>\n");
printf("更新了约翰的无限迷宫3.0\n");
printf("是否启动约翰的无限迷宫BGM?\n1 是\n0 否");
scanf("%d",&n);
if(n==0)
{
printf("已关闭BGM");
break;
}
else if(n==1)
{
printf("已开启BGM");
system("start ZCom.mp3");
break;
}
else
{
printf("无效输入");
Sleep(2000);
}
}
Sleep(1000);
system("CLS");
cout<<"欢";
Sleep(1000);
cout<<"迎";
Sleep(1000);
cout<<"来";
Sleep(1000);
cout<<"玩";
Sleep(1000);
cout<<"游";
Sleep(1000);
cout<<"戏";
Sleep(1000);
system("CLS");
cout<<"某";
Sleep(1);
cout<<"一";
Sleep(1);
cout<<"天";
Sleep(1);
cout<<",";
Sleep(1);
cout<<"约";
Sleep(1);
cout<<"翰";
Sleep(1);
cout<<"走";
Sleep(1);
cout<<"进";
Sleep(1);
cout<<"了";
Sleep(1);
cout<<"一";
Sleep(1);
cout<<"个";
Sleep(1);
cout<<"迷";
Sleep(1);
cout<<"宫";
Sleep(1);
cout<<",";
Sleep(1);
cout<<"请";
Sleep(1);
cout<<"帮";
Sleep(1);
cout<<"助";
Sleep(1);
cout<<"它";
Sleep(1);
cout<<"逃";
Sleep(1);
cout<<"脱";
Sleep(1);
cout<<"。";
Sleep(1);
MessageBox(NULL,"请点击确定后进行讲解游戏规则。","提示",MB_OK);
system("CLS");
cout<<"游戏开始后,屏幕上会出现7个数,只要你回答对“1”是第几个数,即可进行下一关,否则,游戏结束,展示出游戏结果。";
MessageBox(NULL,"点击确定后,游戏开始。","提示",MB_OK);
Sleep(1);
system("CLS");
while(true)
{
string a[7]={"1000000","0100000","0010000","0001000","0000100","0000010","0000001"};
int sum=0;
while(1)
{
srand(time(0));
int n=rand()%6;
string shu=a[n];
cout<<shu<<endl;
int f;
cin>>f;
if(f-1==n)
{
sum++;
Sleep(1);
system("CLS");
}
else
{
Sleep(1);
system("CLS");
break;
}
}
cout<<"G";
Sleep(1);
cout<<"a";
Sleep(1);
cout<<"m";
Sleep(1);
cout<<"e";
Sleep(1);
cout<<" ";
Sleep(1);
cout<<"o";
Sleep(1);
cout<<"v";
Sleep(1);
cout<<"e";
Sleep(1);
cout<<"r";
Sleep(1);
cout<<"!";
Sleep(3000);
system("CLS");
cout<<"通关的数量:"<<sum;
Sleep(3000);
system("CLS");
cout<<"游";
Sleep(1000);
cout<<"戏";
Sleep(1000);
cout<<"结";
Sleep(1000);
cout<<"束";
Sleep(1000);
cout<<"!";
Sleep(3000);
getchar();
system("CLS");
cout<<"输入0重新开始!"<<endl;
cout<<"输入-1退出"<<endl;
int n;
cin>>n ;
if(n==0)
{
Sleep(5000);
system("CLS");
}
else if(n==-1)
{
break;
}
i++;
}
system("cls");
printf("曲终一散,黄粱一梦\n");
Sleep(2000);
printf("Wake Up\n");
Sleep(2000);
printf("出自MC终末之诗\n");
Sleep(2000);
system("cls");
printf("制作者名单\n");
Sleep(2000);
printf("软件制作者:周子毅6200\n");
Sleep(2000);
printf("感谢LJL为约翰的无限迷宫提供的帮助\n");
Sleep(3000);
printf("谢谢参与游戏~~Byebye!");
Sleep(1000);
return 0;
}