提交 10d6df33 编写于 作者: 金小鲸's avatar 金小鲸

GO世界1.0

上级 1ab76f66
#include <iostream>
#include <cstdio>
#include <conio.h>
#include <windows.h>
using namespace std;
void over()
{
system("cls");
system("color A4");
cout<<"你撑死了!"<<endl;
}
int main()
{
system("title GO世界");
char a[100][100]=
{
"##########################################################",
"#A #",
"# #",
"# #",
"#################### #",
"# # #",
"# # #",
"# # ######### #",
"# # #",
"# # #",
"# # #",
"# ####################### #",
"# #",
"# #",
"# #",
"######################## # #",
"# # #",
"# # #",
"# # #",
"# # #",
"# ###################### #",
"# ############ #",
"# #",
"# #",
"# #",
"##########################################################",
};
int z;
system("cls");
system("color CE");
cout<<"欢迎来到GO世界!请做出你的选择!"<<endl;
cout<<"1.进入游戏 2.退出游戏 3.彩蛋"<<endl;
while(z!=1||z!=2||z==3)
{
cout<<"输入你的选择:";
cin>>z;
if(z==1)
{
break;
}
else if(z==2)
{
system("pause");
return 0;
}
else if(z==3)
{
system("start https://www.bilibili.com/video/BV1hq4y1s7VH/?");
}
}
system("cls");
system("color 09");
for(int i=0; i<=25; i++)
puts(a[i]);
char ch;
int dmax=0;
int x=1,y=1;
while(1)
{
ch=_getch();
//w上 a左 s下 d右 q放豆($) f放方块(#)
if(dmax==25)
{
break;
}
if(ch=='q')
{
a[x][y]='$';
if(a[x][y-1]=='#')
y++;
else if(a[x+1][y]=='#')
x--;
else if(a[x-1][y]=='#')
x++;
else if(a[x][y+1]=='#')
y--;
else
x++;
a[x][y]='A';
dmax++;
}
if(ch=='f')
{
a[x][y]='#';
if(a[x][y-1]=='#')
y++;
else if(a[x+1][y]=='#')
x--;
else if(a[x-1][y]=='#')
x++;
else if(a[x][y+1]=='#')
y--;
else
x++;
a[x][y]='A';
}
if(ch=='a')
{
if(a[x][y-1]!='#')
{
a[x][y]=' ';
y--;//往左
a[x][y]='A';
}
}
if(ch=='s')
{
if(a[x+1][y]!='#')
{
a[x][y]=' ';
x++;//往下
a[x][y]='A';
}
}
if(ch=='d')
{
if(a[x][y+1]!='#')
{
a[x][y]=' ';
y++;//往右
a[x][y]='A';
}
}
if(ch=='w')
{
if(a[x-1][y]!='#')
{
a[x][y]=' ';
x--;//往上
a[x][y]='A';
}
}
system("cls");
for(int i=0; i<=25; i++)
puts(a[i]);
}
over();
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册