作品栏
dancing line 2D:
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
enum ConsoleColor {
BLACK = 0,
BLUE = 1,
GREEN = 2,
CYAN = 3,
RED = 4,
MAGENTA = 5,
BROWN = 6,
LIGHT_GRAY = 7,
DARK_GRAY = 8,
LIGHT_BLUE = 9,
LIGHT_GREEN = 10,
LIGHT_CYAN = 11,
LIGHT_RED = 12,
LIGHT_MAGENTA = 13,
YELLOW = 14,
WHITE = 15
};
void SetConsoleColor(ConsoleColor color) {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, color);
}
char a[100][100] = {" | | \0",
"-+ +---+ o \0",
" | | 50% \0",
" | --- |-- ---o \0",
"-+ | | \0",
"--- ------+|-+ -| | 80% \0",
" [o] | | \0",
" | + +------\0",
" | | \0",
" 100% +--- \0"
};
int main(){
cout << "致敬:\n";
cout << "+--- | +--+ +---\n";
cout << "| | | |__| |__+ \n";
cout << "+--- +--- | \\ ___|\n";
Sleep(1000);
system("cls");
cout << "N:";
int n;
cin >> n;
cout << "M:";
int m;
cin >> m;
system("cls");
int lineRAP = 0;//0为右, 1为下;
int x = 0, y = 0, tx = 0, ty = 0;
int index = 0;
bool flag = 1;
Sleep(1000);
SetConsoleColor(WHITE);
while(x < n && y < m){
for(int i = tx; i <= tx + 10; i++){
for(int j = ty; j <= ty + 10; j++){
if((i == x && j == y) || a[i][j] == '!'){
if(a[i][j] != ' ' && a[i][j] != '!'){
flag = 0;
system("cls");
break;
}
a[i][j] = '!';
SetConsoleColor(RED);
cout << "█";
}else{
SetConsoleColor(WHITE);
cout << a[i][j];
}
}
if(!flag){
break;
}
cout << '\n';
}
if(!flag){
break;
}
if(KEY_DOWN(32)){
lineRAP = 1 - lineRAP;
}
if(lineRAP == 1){
if(index % 2 == 1){
tx++;
}
x++;
}else{
if(index % 2 == 1){
ty++;
}
y++;
}
index++;
Sleep(20);
system("cls");
}
if(!flag){
cout << "-------fail---------\n";
return 0;
}
cout << "END ----------- END\n";
return 0;
}
mario 2D
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
char maps1[100][100] = {"********************************************************************\0",
" \0",
" *** \0",
" **** *** *** \0",
" **** \0",
" \0",
"= \0",
"********************************************************************\0"};
enum ConsoleColor {
BLACK = 0,
BLUE = 1,
GREEN = 2,
CYAN = 3,
RED = 4,
MAGENTA = 5,
BROWN = 6,
LIGHT_GRAY = 7,
DARK_GRAY = 8,
LIGHT_BLUE = 9,
LIGHT_GREEN = 10,
LIGHT_CYAN = 11,
LIGHT_RED = 12,
LIGHT_MAGENTA = 13,
YELLOW = 14,
WHITE = 15
};
void SetConsoleColor(ConsoleColor color) {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, color);
}
int main(){
int x = 0, y = 0;
for(int i = 0; i < 8; i++){
int n = strlen(maps1[i]);
for(int j = 0; j < n; j++){
if(maps1[i][j] == '='){
x = i, y = j;
break;
}
}
}
int menu = 1;
bool flag = 1;
while(true){
if(flag){
system("cls");
SetConsoleColor(WHITE);
cout << "----------------\n";
cout << " mario 2D \n";
cout << "----------------\n\n";
SetConsoleColor(WHITE);
if(menu == 1){
SetConsoleColor(BLUE);
}
cout << " < start >\n\n";
SetConsoleColor(WHITE);
if(menu == 2){
SetConsoleColor(BLUE);
}
cout << " < about.>\n\n";
flag = 0;
}
Sleep(100);
if(KEY_DOWN(38)){
if(menu != 1){
menu--;
}
flag = 1;
}
if(KEY_DOWN(40)){
if(menu != 2){
menu++;
}
flag = 1;
}
if(KEY_DOWN(13)){
SetConsoleColor(WHITE);
system("cls");
break;
}
}
if(menu == 1){
int up = 0;
int dx = 0;
int index = 0;
while(1){
if(maps1[x + 1][y] != '*' && up == 0){
maps1[x][y] = ' ';
x += 1;
maps1[x][y] = '=';
}
if(up == 1 && index <= 3 && maps1[x - 1][y] != '*'){
maps1[x][y] = ' ';
maps1[x - 1][y] = '=';
x--;
index++;
}else{
up = 0, index = 0;
}
for(int i = 0; i < 8; i++){
int n = strlen(maps1[i]);
for(int j = 0; j < n; j++){
cout << maps1[i][j];
}
cout << '\n';
}
Sleep(10);
if(KEY_DOWN(87) && maps1[x + 1][y] == '*'){
up = 1;
}
if(KEY_DOWN(65) && y > 0 && maps1[x][y - 1] != '*'){
maps1[x][y] = ' ';
y--;
maps1[x][y] = '=';
}
if(KEY_DOWN(68) && maps1[x][y + 1] != '*'){
maps1[x][y] = ' ';
y++;
maps1[x][y] = '=';
}
system("cls");
}
}else if(menu == 2){
//about.
system("start https://hydro.ac/user/38322");
}
return 0;
}
砖块版mario
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#define M 8
char maps1[100][100] = {"********************************************************************\0",
" *\0",
" *** *\0",
" **** *** *** *\0",
" **** *\0",
" *\0",
"= *\0",
"********************************************************************\0"};
enum ConsoleColor {
BLACK = 0,
BLUE = 1,
GREEN = 2,
CYAN = 3,
RED = 4,
MAGENTA = 5,
BROWN = 6,
LIGHT_GRAY = 7,
DARK_GRAY = M,
LIGHT_BLUE = 9,
LIGHT_GREEN = 10,
LIGHT_CYAN = 11,
LIGHT_RED = 12,
LIGHT_MAGENTA = 13,
YELLOW = 14,
WHITE = 15
};
void SetConsoleColor(ConsoleColor color) {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, color);
}
int main(){
int x = 0, y = 0;
for(int i = 0; i < M; i++){
int n = strlen(maps1[i]);
for(int j = 0; j < n; j++){
if(maps1[i][j] == '='){
x = i, y = j;
break;
}
}
}
int menu = 1;
bool flag = 1;
while(true){
if(flag){
system("cls");
SetConsoleColor(WHITE);
cout << "----------------\n";
cout << " mario 2D \n";
cout << "----------------\n\n";
SetConsoleColor(WHITE);
if(menu == 1){
SetConsoleColor(BLUE);
}
cout << " < start >\n\n";
SetConsoleColor(WHITE);
if(menu == 2){
SetConsoleColor(BLUE);
}
cout << " < about.>\n\n";
flag = 0;
}
Sleep(100);
if(KEY_DOWN(38)){
if(menu != 1){
menu--;
}
flag = 1;
}
if(KEY_DOWN(40)){
if(menu != 2){
menu++;
}
flag = 1;
}
if(KEY_DOWN(13)){
SetConsoleColor(WHITE);
system("cls");
break;
}
}
if(menu == 1){
int up = 0;
int dx = 0;
int dy = 0;
int cntx1 = 0;
int cntx2 = 0;
int cnty = 0;
int index = 0;
bool flag2 = 1;
while(1){
if(maps1[x + 1][y] != '*' && up == 0){
maps1[x][y] = ' ';
x += 1;
maps1[x][y] = '=';
flag2 = 1;
}
if(up == 1 && index <= 3 && maps1[x - 1][y] != '*'){
maps1[x][y] = ' ';
maps1[x - 1][y] = '=';
x--;
index++;
flag2 = 1;
}else{
up = 0, index = 0;
}
if(flag2){
system("cls");
for(int i = 0; i < M; i++){
int n = strlen(maps1[i]);
for(int j = dx; j < dx + 9; j++){
if(j < n){
cout << maps1[i][j];
}
}
cout << '\n';
}
flag2 = 0;
}
Sleep(10);
if(KEY_DOWN(87) && maps1[x + 1][y] == '*'){
up = 1;
}
if(KEY_DOWN(65) && y > 0 && maps1[x][y - 1] != '*'){
maps1[x][y] = ' ';
y--;
cntx2++;
if(cntx2 >= 5){
dx--;
cntx1 = 0;
}
maps1[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(68) && maps1[x][y + 1] != '*'){
maps1[x][y] = ' ';
y++;
cntx1++;
if(cntx1 >= 5){
dx++;
cntx2 = 0;
}
maps1[x][y] = '=';
flag2 = 1;
}
}
}else if(menu == 2){
//about.
system("start https://hydro.ac/user/38322");
}
return 0;
}
level over:
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#define M 6
char maps1[100][100] = {"************************",
"*** ***",
"*** ***",
"*** ***",
"***= f***",
"************************"};
char maps2[100][100] = {"************************",
"*** ***",
"*f ***",
"* * ***",
"*R*= ***",
"************************"};
char maps3[100][100] = {"************************",
"*** ***",
"*** ***",
"*** ***",
"***= f***",
"*******RR**RR**RR*******"};
char maps4[100][100] = {"************************",
"*** ***",
"*** ***",
"*** ***",
"***= f***",
"************RRR*********"};
char maps5[100][100] = {"************************",
"*** ***",
"*** ***",
"*** ***",
"***f =R**",
"************************"};
char maps6[100][100] = {"************************",
"**= ***",
"*** ***",
"*** ***",
"***R f***",
"************************"};
enum ConsoleColor {
BLACK = 0,
BLUE = 1,
GREEN = 2,
CYAN = 3,
RED = 4,
MAGENTA = 5,
BROWN = 6,
LIGHT_GRAY = 7,
DARK_GRAY = 8,
LIGHT_BLUE = 9,
LIGHT_GREEN = 10,
LIGHT_CYAN = 11,
LIGHT_RED = 12,
LIGHT_MAGENTA = 13,
YELLOW = 14,
WHITE = 15
};
void SetConsoleColor(ConsoleColor color) {
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, color);
}
void animate_1(){
system("cls");
cout << "------------------\n";
Sleep(100);
cout << "------------------\n";
Sleep(100);
cout << "------------------\n";
Sleep(100);
cout << "------------------\n";
Sleep(100);
cout << "------------------\n";
Sleep(100);
cout << "------------------\n";
Sleep(100);
cout << "------------------\n";
Sleep(100);
system("cls");
}
void play_1(){
int lives = 5;
int startx = 0, starty = 0;
int x = 0, y = 0;
for(int i = 0; i < M; i++){
int n = strlen(maps1[i]);
for(int j = 0; j < n; j++){
if(maps1[i][j] == '='){
x = i, y = j;
startx = i, starty = j;
break;
}
}
}
{//first
bool numck = 0;
int cunx = 0;
int cuny = 0;
int up = 0;
int cntx1 = 0;
int cntx2 = 0;
int index = 0;
bool flag2 = 1;
while(1){
if(maps1[x + 1][y] != '*' && up == 0 && maps1[x + 1][y] != 'R'){
if(maps1[x + 1][y] == 'f'){
break;
}
maps1[x][y] = ' ';
x += 1;
maps1[x][y] = '=';
flag2 = 1;
}else if(maps1[x + 1][y] == 'R'){
if(lives != 0){
lives--;
system("cls");
cout <<"\n\n\n lives ×" << lives;
Sleep(1000);
maps1[x][y] = ' ';
x = cunx;
y = cuny;
maps1[x][y] = '=';
flag2 = 1;
}else{
lives = 5;
cout << "\n\n\n No lives! \n\n\n";
Sleep(1000);
maps1[x][y] = ' ';
maps1[startx][starty] = '=';
x = startx, y = starty;
flag2 = 1;
}
}
if(up == 1 && index <= 1 && maps1[x - 1][y] != '*' && maps1[x - 1][y] != 'f'){
maps1[x][y] = ' ';
maps1[x - 1][y] = '=';
x--;
index++;
flag2 = 1;
}else if(maps1[x - 1][y] == 'f'){
break;
}else{
up = 0, index = 0;
}
if(y == 6 && !numck){
maps1[5][7] = 'R';
maps1[5][8] = 'R';
flag2 = 1;
numck = 1;
}
if(flag2){
system("cls");
cout << "level 1:\n";
for(int i = 0; i < M; i++){
int n = strlen(maps1[i]);
for(int j = 0; j < n; j++){
if(j < n){
if(maps1[i][j] == 'R'){
SetConsoleColor(RED);
cout << "█";
}else if(maps1[i][j] == 'f'){
SetConsoleColor(GREEN);
cout << "f";
}
else{
SetConsoleColor(WHITE);
cout << maps1[i][j];
}
}
}
cout << '\n';
}
flag2 = 0;
}
Sleep(25);
if(KEY_DOWN(87) && maps1[x + 1][y] == '*'){
up = 1;
}
if(KEY_DOWN(65) && y > 0 && maps1[x][y - 1] != '*'){
if(maps1[x][y - 1] == 'f'){
break;
}
maps1[x][y] = ' ';
y--;
cntx2++;
maps1[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(68) && maps1[x][y + 1] != '*'){
if(maps1[x][y + 1] == 'f'){
return;
}
maps1[x][y] = ' ';
y++;
cntx1++;
maps1[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(67)){
cunx = x;
cuny = y;
}
}
}
}
void play_2(){
int lives = 5;
int startx = 0, starty = 0;
int x = 0, y = 0;
for(int i = 0; i < M; i++){
int n = strlen(maps2[i]);
for(int j = 0; j < n; j++){
if(maps2[i][j] == '='){
x = i, y = j;
startx = i, starty = j;
break;
}
}
}
{//second
int cunx = 0;
int cuny = 0;
int up = 0;
int cntx1 = 0;
int cntx2 = 0;
int index = 0;
bool flag2 = 1;
while(1){
if(maps2[x + 1][y] != '*' && up == 0 && maps2[x + 1][y] != 'R'){
if(maps2[x + 1][y] == 'f'){
break;
}
maps2[x][y] = ' ';
x += 1;
maps2[x][y] = '=';
flag2 = 1;
}else if(maps2[x + 1][y] == 'R'){
if(lives != 0){
lives--;
system("cls");
cout <<"\n\n\n lives ×" << lives;
Sleep(1000);
maps2[x][y] = ' ';
x = cunx;
y = cuny;
maps2[x][y] = '=';
flag2 = 1;
}else{
lives = 5;
cout << "\n\n\n No lives! \n\n\n";
Sleep(1000);
maps2[x][y] = ' ';
maps2[startx][starty] = '=';
x = startx, y = starty;
flag2 = 1;
}
}
if(up == 1 && index <= 1 && maps2[x - 1][y] != '*' && maps2[x - 1][y] != 'f'){
maps2[x][y] = ' ';
maps2[x - 1][y] = '=';
x--;
index++;
flag2 = 1;
}else if(maps2[x - 1][y] == 'f'){
break;
}else{
up = 0, index = 0;
}
if(flag2){
system("cls");
cout << "level 2:\n";
for(int i = 0; i < M; i++){
int n = strlen(maps2[i]);
for(int j = 0; j < n; j++){
if(j < n){
if(i == 2 && j == 2){
SetConsoleColor(WHITE);
cout << '*';
}
else if(maps2[i][j] == 'R'){
SetConsoleColor(RED);
cout << "█";
}
else if(maps2[i][j] == 'f'){
SetConsoleColor(GREEN);
cout << "f";
}
else{
SetConsoleColor(WHITE);
cout << maps2[i][j];
}
}
}
cout << '\n';
}
flag2 = 0;
}
Sleep(25);
if(KEY_DOWN(87) && maps2[x + 1][y] == '*'){
up = 1;
}
if(KEY_DOWN(65) && y > 0 && maps2[x][y - 1] != '*'){
if(maps2[x][y - 1] == 'f'){
break;
}
maps2[x][y] = ' ';
y--;
cntx2++;
maps2[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(68) && maps2[x][y + 1] != '*'){
if(maps2[x][y + 1] == 'f'){
return;
}
maps2[x][y] = ' ';
y++;
cntx1++;
maps2[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(67)){
cunx = x;
cuny = y;
}
}
}
}
void play_3(){
int lives = 5;
int startx = 0, starty = 0;
int x = 0, y = 0;
for(int i = 0; i < M; i++){
int n = strlen(maps3[i]);
for(int j = 0; j < n; j++){
if(maps3[i][j] == '='){
x = i, y = j;
startx = i, starty = j;
break;
}
}
}
{//third
bool numck = 0;
int cunx = 0;
int cuny = 0;
int up = 0;
int cntx1 = 0;
int cntx2 = 0;
int index = 0;
bool flag2 = 1;
while(1){
if(maps3[x + 1][y] != '*' && up == 0 && maps3[x + 1][y] != 'R'){
if(maps3[x + 1][y] == 'f'){
break;
}
maps3[x][y] = ' ';
x += 1;
maps3[x][y] = '=';
flag2 = 1;
}else if(maps3[x + 1][y] == 'R'){
if(lives != 0){
lives--;
system("cls");
cout <<"\n\n\n lives ×" << lives;
Sleep(1000);
maps3[x][y] = ' ';
x = cunx;
y = cuny;
maps3[x][y] = '=';
flag2 = 1;
}else{
lives = 5;
cout << "\n\n\n No lives! \n\n\n";
Sleep(1000);
maps3[x][y] = ' ';
maps3[startx][starty] = '=';
x = startx, y = starty;
flag2 = 1;
}
}
if(up == 1 && index <= 1 && maps3[x - 1][y] != '*' && maps3[x - 1][y] != 'f'){
maps3[x][y] = ' ';
maps3[x - 1][y] = '=';
x--;
index++;
flag2 = 1;
}else if(maps3[x - 1][y] == 'f'){
break;
}else{
up = 0, index = 0;
}
if(y == 16 && !numck){
maps3[4][17] = '*';
maps3[3][17] = '*';
flag2 = 1;
numck = 1;
}
if(flag2){
system("cls");
cout << "level 3:\n";
for(int i = 0; i < M; i++){
int n = strlen(maps3[i]);
for(int j = 0; j < n; j++){
if(j < n){
if(maps3[i][j] == 'R'){
SetConsoleColor(RED);
cout << "█";
}else if(maps3[i][j] == 'f'){
SetConsoleColor(GREEN);
cout << "f";
}
else{
SetConsoleColor(WHITE);
cout << maps3[i][j];
}
}
}
cout << '\n';
}
flag2 = 0;
}
Sleep(25);
if(KEY_DOWN(87) && maps3[x + 1][y] == '*'){
up = 1;
}
if(KEY_DOWN(65) && y > 0 && maps3[x][y - 1] != '*'){
if(maps3[x][y - 1] == 'f'){
break;
}
maps3[x][y] = ' ';
y--;
cntx2++;
maps3[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(68) && maps3[x][y + 1] != '*'){
if(maps3[x][y + 1] == 'f'){
return;
}
maps3[x][y] = ' ';
y++;
cntx1++;
maps3[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(67)){
cunx = x;
cuny = y;
}
}
}
}
void play_4(){
int lives = 5;
int startx = 0, starty = 0;
int x = 0, y = 0;
for(int i = 0; i < M; i++){
int n = strlen(maps4[i]);
for(int j = 0; j < n; j++){
if(maps4[i][j] == '='){
x = i, y = j;
startx = i, starty = j;
break;
}
}
}
{//fourth
bool numck = 0;
int cunx = 0;
int cuny = 0;
int up = 0;
int cntx1 = 0;
int cntx2 = 0;
int index = 0;
bool flag2 = 1;
while(1){
if(maps4[x + 1][y] != '*' && up == 0 && maps4[x + 1][y] != 'R'){
if(maps4[x + 1][y] == 'f'){
break;
}
maps4[x][y] = ' ';
x += 1;
maps4[x][y] = '=';
flag2 = 1;
}else if(maps4[x + 1][y] == 'R'){
if(lives != 0){
lives--;
system("cls");
cout <<"\n\n\n lives ×" << lives;
Sleep(1000);
maps4[x][y] = ' ';
x = cunx;
y = cuny;
maps4[x][y] = '=';
flag2 = 1;
}else{
lives = 5;
cout << "\n\n\n No lives! \n\n\n";
Sleep(1000);
maps4[x][y] = ' ';
maps4[startx][starty] = '=';
x = startx, y = starty;
flag2 = 1;
}
}
if(up == 1 && index <= 1 && maps4[x - 1][y] != '*' && maps4[x - 1][y] != 'f'){
maps4[x][y] = ' ';
maps4[x - 1][y] = '=';
x--;
index++;
flag2 = 1;
}else if(maps4[x - 1][y] == 'f'){
break;
}else{
up = 0, index = 0;
}
if(y == 19 && !numck){
maps4[4][20] = 'R';
maps4[4][3] = 'f';
flag2 = 1;
numck = 1;
}
if(flag2){
system("cls");
cout << "level 4:\n";
for(int i = 0; i < M; i++){
int n = strlen(maps4[i]);
for(int j = 0; j < n; j++){
if(j < n){
if(maps4[i][j] == 'R'){
SetConsoleColor(RED);
cout << "█";
}else if(maps4[i][j] == 'f'){
SetConsoleColor(GREEN);
cout << "f";
}
else{
SetConsoleColor(WHITE);
cout << maps4[i][j];
}
}
}
cout << '\n';
}
flag2 = 0;
}
Sleep(25);
if(KEY_DOWN(87) && maps4[x + 1][y] == '*'){
up = 1;
}
if(KEY_DOWN(65) && y > 0 && maps4[x][y - 1] != '*'){
if(maps4[x][y - 1] == 'f'){
break;
}
maps4[x][y] = ' ';
y--;
cntx2++;
maps4[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(68) && maps4[x][y + 1] != '*'){
if(maps4[x][y + 1] == 'f'){
return;
}
maps4[x][y] = ' ';
y++;
cntx1++;
maps4[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(67)){
cunx = x;
cuny = y;
}
}
}
}
void play_5(){
int lives = 5;
int startx = 0, starty = 0;
int x = 0, y = 0;
for(int i = 0; i < M; i++){
int n = strlen(maps5[i]);
for(int j = 0; j < n; j++){
if(maps5[i][j] == '='){
x = i, y = j;
startx = i, starty = j;
break;
}
}
}
{//fifth
int cunx = 0;
int cuny = 0;
int up = 0;
int cntx1 = 0;
int cntx2 = 0;
int index = 0;
bool flag2 = 1;
while(1){
if(maps5[x + 1][y] != '*' && up == 0 && maps5[x + 1][y] != 'R'){
if(maps5[x + 1][y] == 'f'){
break;
}
maps5[x][y] = ' ';
x += 1;
maps5[x][y] = '=';
flag2 = 1;
}else if(maps5[x + 1][y] == 'R'){
if(lives != 0){
lives--;
system("cls");
cout <<"\n\n\n lives ×" << lives;
Sleep(1000);
maps5[x][y] = ' ';
x = cunx;
y = cuny;
maps5[x][y] = '=';
flag2 = 1;
}else{
lives = 5;
cout << "\n\n\n No lives! \n\n\n";
Sleep(1000);
maps5[x][y] = ' ';
maps5[startx][starty] = '=';
x = startx, y = starty;
flag2 = 1;
}
}
if(up == 1 && index <= 1 && maps5[x - 1][y] != '*' && maps5[x - 1][y] != 'f'){
maps5[x][y] = ' ';
maps5[x - 1][y] = '=';
x--;
index++;
flag2 = 1;
}else if(maps5[x - 1][y] == 'f'){
break;
}else{
up = 0, index = 0;
}
if(flag2){
system("cls");
cout << "level 4:\n";
for(int i = 0; i < M; i++){
int n = strlen(maps5[i]);
for(int j = 0; j < n; j++){
if(j < n){
if(maps5[i][j] == 'R'){
SetConsoleColor(RED);
cout << "█";
}else if(maps5[i][j] == 'f'){
SetConsoleColor(WHITE);
cout << "=";
}else if(maps5[i][j] == '='){
SetConsoleColor(GREEN);
cout << "f";
}
else{
SetConsoleColor(WHITE);
cout << maps5[i][j];
}
}
}
cout << '\n';
}
flag2 = 0;
}
Sleep(25);
if(KEY_DOWN(87) && maps5[x + 1][y] == '*'){
up = 1;
}
if(KEY_DOWN(65) && y > 0 && maps5[x][y - 1] != '*'){
if(maps5[x][y - 1] == 'f'){
break;
}
maps5[x][y] = ' ';
y--;
cntx2++;
maps5[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(68) && maps5[x][y + 1] != '*'){
if(maps5[x][y + 1] == 'f'){
return;
}
maps5[x][y] = ' ';
y++;
cntx1++;
maps5[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(67)){
cunx = x;
cuny = y;
}
}
}
}
void play_6(){
int lives = 5;
int startx = 0, starty = 0;
int x = 0, y = 0;
for(int i = 0; i < M; i++){
int n = strlen(maps6[i]);
for(int j = 0; j < n; j++){
if(maps6[i][j] == '='){
x = i, y = j;
startx = i, starty = j;
break;
}
}
}
{//sixth
int cunx = 0;
int cuny = 0;
int up = 0;
int cntx1 = 0;
int cntx2 = 0;
int index = 0;
bool flag2 = 1;
while(1){
if(maps6[x + 1][y] != '*' && up == 0 && maps6[x + 1][y] != 'R'){
if(maps6[x + 1][y] == 'f'){
break;
}
maps6[x][y] = ' ';
x += 1;
maps6[x][y] = '=';
flag2 = 1;
}else if(maps6[x + 1][y] == 'R'){
if(lives != 0){
lives--;
system("cls");
cout <<"\n\n\n lives ×" << lives;
Sleep(1000);
maps6[x][y] = ' ';
x = cunx;
y = cuny;
maps6[x][y] = '=';
flag2 = 1;
}else{
lives = 5;
cout << "\n\n\n No lives! \n\n\n";
Sleep(1000);
maps6[x][y] = ' ';
maps6[startx][starty] = '=';
x = startx, y = starty;
flag2 = 1;
}
}
if(up == 1 && index <= 1 && maps6[x - 1][y] != '*' && maps6[x - 1][y] != 'f'){
maps6[x][y] = ' ';
maps6[x - 1][y] = '=';
x--;
index++;
flag2 = 1;
}else if(maps6[x - 1][y] == 'f'){
break;
}else{
up = 0, index = 0;
}
if(flag2){
system("cls");
cout << "level 6:\n";
for(int i = 0; i < M; i++){
int n = strlen(maps6[i]);
for(int j = 0; j < n; j++){
if(j < n){
if(maps6[i][j] == 'R'){
SetConsoleColor(GREEN);
cout << "f";
}else if(maps6[i][j] == 'f'){
SetConsoleColor(RED);
cout << "█";
}
else{
SetConsoleColor(WHITE);
cout << maps6[i][j];
}
}
}
cout << '\n';
}
flag2 = 0;
}
Sleep(25);
if(KEY_DOWN(87) && maps6[x + 1][y] == '*'){
up = 1;
}
if(KEY_DOWN(65) && y > 0 && maps6[x][y - 1] != '*'){
if(maps6[x][y - 1] == 'f'){
break;
}
maps6[x][y] = ' ';
y--;
cntx2++;
maps6[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(68) && maps6[x][y + 1] != '*'){
if(maps6[x][y + 1] == 'f'){
return;
}
maps6[x][y] = ' ';
y++;
cntx1++;
maps6[x][y] = '=';
flag2 = 1;
}
if(KEY_DOWN(67)){
cunx = x;
cuny = y;
}
}
}
}
int main(){
int menu = 1;
bool flag = 1;
while(true){
if(flag){
system("cls");
SetConsoleColor(WHITE);
cout << "---------------------\n";
cout << " L e v e l prime\n";
cout << "-by silly man\n";
cout << "---------------------\n\n";
SetConsoleColor(WHITE);
if(menu == 1){
SetConsoleColor(BLUE);
}
cout << " < start >\n\n";
SetConsoleColor(WHITE);
if(menu == 2){
SetConsoleColor(BLUE);
}
cout << " < about.>\n\n";
flag = 0;
}
Sleep(100);
if(KEY_DOWN(38)){
if(menu != 1){
menu--;
}
flag = 1;
}
if(KEY_DOWN(40)){
if(menu != 2){
menu++;
}
flag = 1;
}
if(KEY_DOWN(13)){
SetConsoleColor(WHITE);
system("cls");
break;
}
}
if(menu == 1){
play_1();
animate_1();
system("cls");
play_2();
animate_1();
system("cls");
play_3();
animate_1();
system("cls");
play_4();
animate_1();
system("cls");
play_5();
animate_1();
system("cls");
play_6();
}else if(menu == 2){
//about.
system("start https://hydro.ac/user/38322");
}
return 0;
}