用户:
研岩查看:18 回复:9 评论:18 创建时间:2020-06-13T10:41:44
巫师无线新闻联播独家播出。
废话不多说,今天我们去的是
缤纷四季

OK,网址
https://box喵lay.codemao.cn/games/74427591082a0d8c喵a1
额啊,小编居然卡在空中下班前也上不了
算了算了,换一个世界

今天我们去
喵战之王
https://box喵lay.codemao.cn/games/10676107c125fb01e76a
顺利
注意事项
碰喵捡喵,没有喵不可以喵
会营回血
额,好像没有了
哦还有,被击败记得双击屏幕回营

小编发现这里也有粒子了
oh,no营地要完蛋
小编要去揍他一顿
好了喵战之王的其他
你们自己去探索吧
想小编光临你的或你喜欢的地图吗
快在下面留言吧!

研岩#include <iostream>
#include <string>
#include <ctime>
#include <conio.h>
#include <Windows.h>
using namespace std;
// 随机生成数字、大写字母、小写字母
char RandomChar()
{
int type = rand() % 3;
if (type == 0)
{
return rand() % 10 + '0';
}
if (type == 1)
{
return rand() % 26 + 'A';
}
return rand() % 26 + 'a';
}
// 将光标移到控制台(x,y)处。
void gotoxy(int x, int y)
{
CONSOLE_SCREEN_BUFFER_INFO cs;
HANDLE hC喵oleOut = GetStdHandle(STD_OUTPUT_HANDLE);
GetC喵oleScreenBufferInfo(hC喵oleOut, &cs);
cs.dwCursorPosition.X = y;
cs.dwCursorPosition.Y = x;
SetC喵oleCursorPosition(hC喵oleOut,
cs.dwCursorPosition);
}
int main()
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);//获取控制台的句柄,用于随意改变字体颜色
cout << "游戏说明:\n";
cout <<"屏幕会掉落若干字符,正确敲击越多,游戏得分也就越高,字符落到终点线为游戏结束标志\n\n";
cout << "请按任意键继续\n\n";
getch();
cout << "请按任意键开始游戏\n";
getch();
system("cls");//清除屏幕当前所有信息
bool again = 1;//判断是否重来游戏
while (again)
{
srand((unsigned int)time(NULL));//随机产生数字
int x[100];//记录x轴信息
int y[100];//记录y轴信息
char target[100];//记录字符信息
int score = 0;//游戏得分
cout << "请按数字键选择游戏难度:\n";
cout << "1:" << "简单" << endl;
cout << "2:" << "初级" << endl;
cout << "3:" << "普通" << endl;
cout << "4:" << "困难" << endl;
cout << "5:" << "复杂" << endl;
cout << endl;
int n;
cin >> n;
system("cls");//清除屏幕当前所有信息
gotoxy(0, 55);//游戏得分位置
cout << "当前得分:" << score;
SetC喵oleTextAttribute(hOut,
FOREGROUND_RED |
FOREGROUND_INTENSITY); //红色
gotoxy(20 - 2 * n, 0);//按难度定义游戏终止位置
cout << "-------终---------------点------------------线-------" << endl;
SetC喵oleTextAttribute(hOut,
FOREGROUND_GREEN |
FOREGROUND_INTENSITY); //绿色
for (int i = 1; i <= 2 * n; i++)
{
x[i] = 0;
y[i] = rand() % 50;
}
for (int i = 1; i <= 2 * n; i++)
{
target[i] = RandomChar();
}
bool gameOver = 0;//判断是否游戏结束
while (gameOver == 0)
{
while (!kbhit()) // 当用户没按键的时候
{
for (int i = 1; i <= 2 * n; i++)
{
gotoxy(x[i], y[i]);
cout << target[i];
x[i]++;
if (x[i] == 20 - 2 * n) //字符到达底部
{
gameOver = 1;
}
}
Sleep(1000 - n * 100);//按难度定义字符掉落速度
for (int i = 1; i <= 2 * n; i++)
{
gotoxy(x[i] - 1, y[i]);
cout << ' ';//擦掉上一行的字符
}
if (gameOver)
{
break;
}
}
if (gameOver)//如果没有这个判断,那么当字符掉落到终点线时,如果用户没有按键,则游戏不会结束
{
break;
}
char userHit = getch();
for (int i = 1; i <= 2 * n; i++)
{
if (target[i] == userHit)// 用户击中屏幕字符
{
score++;
gotoxy(0, 65);
cout << score;
gotoxy(x[i], y[i]);
cout << ' ';//消除字符
// 重新生成字符
x[i] = 0;
y[i] = rand() % 50;
target[i] = RandomChar();
}
}
}
SetC喵oleTextAttribute(hOut,
FOREGROUND_RED |
FOREGROUND_GREEN |
FOREGROUND_BLUE |
FOREGROUND_INTENSITY); //白色
gotoxy(20 - 2 * n + 2, 0);
cout << "很遗憾,游戏结束!\n您当前得分为:";
SetC喵oleTextAttribute(hOut,
FOREGROUND_GREEN |
FOREGROUND_INTENSITY); //绿色
cout << score;
SetC喵oleTextAttribute(hOut,
FOREGROUND_RED |
FOREGROUND_GREEN |
FOREGROUND_BLUE |
FOREGROUND_INTENSITY); //白色
cout << "分\n\n是否再挑战一次? Y/N\n";
string str;
cin >> str;
if (str == "N" || str == "n")
{
cout << "感谢使用,欢迎下次再来!\n";
break;
}
else
{
system("cls");//清除屏幕当前所有信息
}
}
return 0;
}点赞0
评论