分享一个有趣的自创C++小游戏
别忘了一连三键哦
#include <bits/stdc++.h>
#include <windows.h>
#include <time.h>
#include <conio.h>
using namespace std;
int jiu1[11], jiu2[11], jiu3[11];
int yi,er,sa;
int die;
//上:1 下:2 左:4 右:6
int a[1111][30][30] = {{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,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,2,2,2,2,2,0,0,0,0,0},{0,0,0,0,0,0,1,0,0,0,0,0,0,0,6,0,0,0,0,0},{0,0,0,0,0,0,4,4,4,4,4,6,6,6,6,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},},{{0,0,0,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,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6,2,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,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,6,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0},{0,0,0,0,0,1,1,1,1,1,1,0,0,1,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,4,0,0,6,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,2,4,0,0,6,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,0,0,0},{0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,4,0,0,0,0},{0,0,0,1,0,0,0,0,0,0,2,0,0,0,0,4,0,0,0,0},{0,0,0,0,1,0,0,0,0,0,0,2,0,0,1,4,0,0,0,0},{0,0,0,0,0,1,0,0,0,0,0,0,2,1,0,4,0,0,0,0},{0,0,0,0,0,0,1,0,0,0,0,1,1,4,0,4,0,0,0,0},{0,0,0,0,0,0,0,6,0,0,0,6,0,6,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,1,0,1,0,0,6,0,4,0,0,0,0},{0,0,0,0,0,0,0,0,0,1,0,0,0,6,0,4,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},},
};
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
VOID SetPosC(COORD a) { // set cursorHANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(out, a);
}
VOID SetPos(int x, int y) { // set cursor2COORD pos= {x, y};SetPosC(pos);
}
//1蓝 2绿 3淡蓝 4红 5粉 6土黄 7白 8灰 color(前景,背景)
void color(int ForgC, int BackC) {WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}
void HideCursor(bool Visible) {CONSOLE_CURSOR_INFO Cursor;Cursor.bVisible = !Visible;Cursor.dwSize = sizeof(Cursor);HANDLE Hand = GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorInfo(Hand, &Cursor);
}
void slowsay(string s) {for (int i = 0; i < s.size(); i++) {cout << s[i];Sleep(30);}
}
int read() {char ch=_getch();while(ch>'9'||ch<'0') ch=_getch();return ch-48;
}
bool ok(int guan) {for (int i = 0; i < 20; i++) {for (int j = 0; j < 20; j++) {if (a[guan][i][j]) return false;}}return true;
}
void go(int guan) {SetPos(0, 0);printf("第%d关\n\n", guan + 1);for (int i = 0; i < 20; i++) {if (i == 0) {color(1, 0);for (int j = 0; j < 40; j++) {printf("-");}printf("\n");}for (int j = 0; j < 20; j++) {if (j == 0) {color(4, 0);printf("|");}color(a[guan][i][j], 0);printf("■");if (j == 19) {color(6, 0);printf("|");}}printf("\n");if (i == 19) {color(2, 0);for (int j = 0; j < 40; j++) {printf("-");}printf("\n");}}
}
void start(int guan) {
abc:SetPos(0, 0);printf("第%d关\n\n", guan + 1);for (int i = 0; i < 20; i++) {if (i == 0) {color(1, 0);for (int j = 0; j < 40; j++) {printf("-");}printf("\n");}for (int j = 0; j < 20; j++) {if (j == 0) {color(4, 0);printf("|");}color(a[guan][i][j], 0);printf("■");if (j == 19) {color(6, 0);printf("|");}}printf("\n");if (i == 19) {color(2, 0);for (int j = 0; j < 40; j++) {printf("-");}printf("\n");}}if (ok(guan)) {MessageBox(NULL, "做答成功!", "作答成功", MB_OK);SetPos(0, 0);return;}int x = _getch();int op = -1;if (KEY_DOWN(VK_UP)) op = 1;if (KEY_DOWN(VK_DOWN)) op = 2;if (KEY_DOWN(VK_LEFT)) op = 3;if (KEY_DOWN(VK_RIGHT)) op = 4;if (x == 27) {MessageBox(NULL, "失败乃成功之母", "作答“成功”", MB_OK);exit(0);} else if (x == 13) {MessageBox(NULL, "再来一遍!", "AGAIN!", MB_OK);for (int i = 0; i < 20; i++) {for (int j = 0; j < 20; j++) {a[guan][i][j] = xcc[guan][i][j];}}goto abc;}if (op == 1) {for (int i = 0; i < 20; i++) {for (int j = 0; j < 20; j++) {if (a[guan][i][j]) {int k = 0;while (a[guan][k][j]) k++;if (k >= i) continue;a[guan][k][j] = a[guan][i][j];a[guan][i][j] = 0;if (a[guan][k][j] == 1 && k == 0) {a[guan][k][j] = 0;}go(guan);}}}} else if (op == 2) {for (int i = 19; i >= 0; i--) {for (int j = 19; j >= 0; j--) {if (a[guan][i][j]) {int k = 19;while (a[guan][k][j]) k--;if (k <= i) continue;a[guan][k][j] = a[guan][i][j];a[guan][i][j] = 0;if (a[guan][k][j] == 2 && k == 19) {a[guan][k][j] = 0;}go(guan);}}}} else if (op == 3) {for (int j = 0; j < 20; j++) {for (int i = 0; i < 20; i++) {if (a[guan][i][j]) {int k = 0;while (a[guan][i][k]) k++;if (k >= j) continue;a[guan][i][k] = a[guan][i][j];a[guan][i][j] = 0;if (a[guan][i][k] == 4 && k == 0) {a[guan][i][k] = 0;}go(guan);}}}} else if (op == 4) {for (int j = 19; j >= 0; j--) {for (int i = 0; i < 20; i++) {if (a[guan][i][j]) {int k = 19;while (a[guan][i][k]) k--;if (k <= j) continue;a[guan][i][k] = a[guan][i][j];a[guan][i][j] = 0;if (a[guan][i][k] == 6 && k == 19) {a[guan][i][k] = 0;}go(guan);}}}}start(guan);
}
signed main() {srand(time(NULL));HideCursor(true);SetPos(50, 6);color(2, 0);slowsay("【版本7.2.16】最新版本————更新中(目前共6关)");SetPos(50, 8);slowsay("作者『逍遥君』");SetPos(50, 10);slowsay("「板块消除」");SetPos(50, 12);slowsay("逍遥君办公室");SetPos(50, 14);slowsay("放弃挑战按[ESC],重来此关按[ENTER]");SetPos(50, 16);slowsay("一直打完所有关卡才算通关");SetPos(0, 25);slowsay("玩法:按上、下、左、右键可以让所有颜色的方块向上、下、左、右移动");SetPos(0, 26);slowsay("上、下、左、右各有一栏颜色条,和它相同的颜色碰到它会消失");SetPos(0, 27);slowsay("你需要让整个盘面里面的颜色全部消失【注意:当颜色本来就在消除线旁边时,再继续移动则不会被消除】\n");SetPos(15, 10);printf(" ■■■■");SetPos(15, 11);printf(" ■ ■");SetPos(15, 12);printf(" ■");SetPos(15, 13);printf(" ■ ");SetPos(15, 14);printf(" ■■ ");SetPos(15, 15);printf(" ■ ");SetPos(15, 16);printf(" ■");SetPos(15, 17);printf(" ■ ■");SetPos(15, 18);printf(" ■■■■");Sleep(1000);SetPos(15, 10);cout << " \n \n \n \n \n \n \n \n \n";SetPos(0, 0);SetPos(15, 10);printf(" ■■■■");SetPos(15, 11);printf(" ■ ■");SetPos(15, 12);printf(" ■");SetPos(15, 13);printf(" ■ ");SetPos(15, 14);printf(" ■ ");SetPos(15, 15);printf(" ■ ");SetPos(15, 16);printf(" ■");SetPos(15, 17);printf("■");SetPos(15, 18);printf("■■■■■");Sleep(1000);SetPos(15, 10);cout << " \n \n \n \n \n \n \n \n \n";SetPos(15, 10);printf(" ■");SetPos(15, 11);printf(" ■ ■");SetPos(15, 12);printf(" ■");SetPos(15, 13);printf(" ■ ");SetPos(15, 14);printf(" ■ ");SetPos(15, 15);printf(" ■ ");SetPos(15, 16);printf(" ■");SetPos(15, 17);printf(" ■");SetPos(15, 18);printf("■■■■■■■");Sleep(1000);SetPos(15, 10);cout << " \n \n \n \n \n \n \n \n \n";SetPos(0, 0);int end = 6;for (int i = 0; i < end; i++) {MessageBox(NULL, "开始游戏", "下一关", MB_OK);start(i);}system("cls");slowsay("Thanks for playing...\n");slowsay("您已通关,亲爱的大脑玩家,您还没玩够吗?");return 0;
}