1
已解决
王子逸
新手天翼
新手天翼
我自创的小游戏,有许多不足,望谅解,比如画质,ad键走时会有问题,穿墙破坏地图等。
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<conio.h>
using namespace std;
int main()
{
int x=8,y=31;
char ch;
int a[11][36]{{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,1,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,1,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,1,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,1,0,0,0,0,0,0,0,0,1,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,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1},
{1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};
while(1)
{
for(int i=0;i<=10;i++)
{
for(int j=0;j<=35;j++)
{
if(a[i][j]==1)
{
cout<<"OT";
}
else if(a[i][j]==2)
{
cout<<"HH";
}
else if(a[i][j]==3)
{
cout<<"N ";
}
else if(a[i][j]==0)
{
cout<<" ";
}
else if(a[i][j]==9)
{
cout<<"GD";
}
}
cout<<endl;
}
ch=getch();
if(ch=='a')
{
if(a[x+1][y-1]==0&&a[x+1][y]!=1)
{
a[x+1][y-1]=9;
a[x][y]=0;
x++;
y--;
system("cls");
}
else if(a[x][y-1]==1)
{
a[x-1][y-1]=9;
a[x][y]=0;
x--;
y--;
system("cls");
}
else
{
a[x][y-1]=9;
a[x][y]=0;
y--;
system("cls");
}
}
else if(ch=='f')
{
a[x][y-2]==1;
system("cls");
}
else if(ch=='d')
{
if(a[x+1][y+1]==0&&a[x-1][y]!=1)
{
a[x+1][y+1]=9;
a[x][y]=0;
x++;
y++;
system("cls");
}
else if(a[x][y+1]==1)
{
a[x-1][y+1]=9;
a[x][y]=0;
x--;
y++;
system("cls");
}
else
{
a[x][y+1]=9;
a[x][y]=0;
y++;
system("cls");
}
}
else
{
system("cls");
}
}
return 0;
}
王子逸在2020-05-11 19:45:38追加了内容
我哪有刘景成大佬厉害,在他面前,我只是一个小渣渣
王子逸在2020-05-15 13:30:37追加了内容
1.5.0出来了,更新,z键可在脚下放置
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<conio.h>
using namespace std;
int main()
{
int x=8,y=31;
char ch;
int a[11][36]{{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,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,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,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,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,1,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},
{1,1,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,9,0,0,0,0},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};
while(1)
{
for(int i=0;i<=10;i++)
{
for(int j=0;j<=35;j++)
{
if(a[i][j]==1)
{
cout<<"OT";
}
else if(a[i][j]==2)
{
cout<<"HH";
}
else if(a[i][j]==3)
{
cout<<"N ";
}
else if(a[i][j]==0)
{
cout<<" ";
}
else if(a[i][j]==9)
{
cout<<"GD";
}
}
cout<<endl;
}
ch=getch();
if(ch=='a')
{
if(a[x+1][y-1]==0&&a[x+1][y]!=1)
{
a[x+1][y-1]=9;
a[x][y]=0;
x++;
y--;
system("cls");
}
else if(a[x][y-1]==1&&a[x-1][y-1]!=1)
{
a[x-1][y-1]=9;
a[x][y]=0;
x--;
y--;
system("cls");
}
else
{
a[x][y-1]=9;
a[x][y]=0;
y--;
system("cls");
}
}
else if(ch=='z'&&a[x-1][y]!=1)
{
a[x][y]=1;
a[x-1][y]=9;
x-=1;
system("cls");
}
else if(ch=='d')
{
if(a[x+1][y+1]==0&&a[x-1][y+1]!=1)
{
a[x+1][y+1]=9;
a[x][y]=0;
x++;
y++;
system("cls");
}
else if(a[x][y+1]==1)
{
a[x-1][y+1]=9;
a[x][y]=0;
x--;
y++;
system("cls");
}
else
{
a[x][y+1]=9;
a[x][y]=0;
y++;
system("cls");
}
}
else
{
system("cls");
}
}
return 0;
}
方块
王子逸在2020-05-16 09:36:49追加了内容
Ok,我按同学
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<conio.h>
#include<Windows.h>
using namespace std;
int main()
{
system("color 04");
int x=8,y=31;
char ch;
int a[11][36]{{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,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,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,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,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,1,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},
{1,1,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,9,0,0,0,0},
{1,1,1,1,1,1,1,1,1,8,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};
while(1)
{
for(int i=0;i<=10;i++)
{
for(int j=0;j<=35;j++)
{
if(a[i][j]==1)
{
cout<<"OT";
}
else if(a[i][j]==2)
{
cout<<"HH";
}
else if(a[i][j]==3)
{
cout<<"N ";
}
else if(a[i][j]==0)
{
cout<<" ";
}
else if(a[i][j]==9)
{
cout<<"GD";
}
else if(a[i][j]==8)
{
cout<<"MM";
}
}
cout<<endl;
}
ch=getch();
if(ch=='a')
{
if(a[x+1][y-1]==8)
{
system("cls");
system("color 0F");
cout<<"\n\n\n\n\t\t\t\t\tGame Over!\n\n\n\n\n\n\n";
Sleep(5000);
return 0;
}
else if(a[x+1][y-1]==0&&a[x+1][y]!=1)
{
a[x+1][y-1]=9;
a[x][y]=0;
x++;
y--;
system("cls");
}
else if(a[x][y-1]==1&&a[x-1][y-1]!=1)
{
a[x-1][y-1]=9;
a[x][y]=0;
x--;
y--;
system("cls");
}
else
{
a[x][y-1]=9;
a[x][y]=0;
y--;
system("cls");
}
}
else if(ch=='z'&&a[x-1][y]!=1)
{
a[x][y]=1;
a[x-1][y]=9;
x-=1;
system("cls");
}
else if(ch=='d')
{
if(a[x+1][y+1]==8)
{
system("cls");
system("color 0F") ;
cout<<"\n\n\n\n\t\t\t\t\tGame Over!\n\n\n\n\n\n\n";
Sleep(5000);
return 0;
}
else if(a[x+1][y+1]==0&&a[x-1][y+1]!=1)
{
a[x+1][y+1]=9;
a[x][y]=0;
x++;
y++;
system("cls");
}
else if(a[x][y+1]==1)
{
a[x-1][y+1]=9;
a[x][y]=0;
x--;
y++;
system("cls");
}
else
{
a[x][y+1]=9;
a[x][y]=0;
y++;
system("cls");
}
}
else
{
system("cls");
}
}
return 0;
}
们的想法更新了颜色以及淘汰机制,只要碰到尖刺就会淘汰,是2.0.1版本了!!
1
已采纳
沈峻宇
资深天翼
资深天翼
牛逼!建议加一些碰到某些东西就失败,增加游戏目标,不然这游戏十分无趣!
建议加上颜色修改,使画质更好
加油!希望尽快出1.5版本!
沈峻宇在2020-05-14 12:31:42追加了内容
其中color后面的0是背景色代号,A是前景色代号。各颜色代码如下:
0=黑色
1=蓝色
2=绿色
3=湖蓝色
4=红色
5=紫色
6=黄色
7=白色
8=灰色
9=淡蓝色
A=淡绿色
B=淡浅绿色
C=淡红色
D=淡紫色
E=淡黄色
F=亮白色
来自-----刘大佬
1
1
1
1
李素妍
新手天翼
新手天翼
游戏怎么玩啊
李素妍在2020-05-11 19:33:23追加了内容
好吧,不能玩
李素妍在2020-05-11 19:35:24追加了内容
good!!!!
1
1
1
1
1