Untitled

 avatar
user_1366777
plain_text
a month ago
34 kB
3
Indexable
Never
#include<iostream>
#include<conio.h>
using namespace std;
void clean_and_draw_border(char x[][150], int r,int c)
{

	for (int i = 0; i < 200; i++)
	{
		for (int j = 0; j < 150; j++)
		{
			x[i][j] = ' ';
		}
	}
	for (int i=r; i <r+ 50; i++)
	{
		x[i][0] = 186;
		x[i][149] = 186;

	}
	for (int i = 1; i < 150; i++)
	{
		x[r+0][i] = 205;
		x[r+2][i] = 205;
		x[r+49][i] = 205;
	}
	x[r][0] = 201;
	x[r+2][0] = 204;
	x[r+49][0] = 200;
	x[r][149] = 187;
	x[r+2][149] = 185;
	x[r+49][149] = 188;

}
void cout_to_screen(char x[][150], int l,int r,int c)
{
	system("cls");
	if (l == 1)
	{
		for (int i = r; i < r+50; i++)
		{
			for (int j = 0; j < 150; j++)
			{
				cout << x[i][j];
			}
			cout << endl;
		}
	}
	
}
void draw_stats(char x[][150], int hlr, int hlc,int r,int c,int reload)
{
	x[r+hlr][hlc] = 'H';
	x[r+hlr][hlc + 1] = 'E';
	x[r+hlr][hlc + 2] = 'A';
	x[r+hlr][hlc + 3] = 'L';
	x[r+hlr][hlc + 4] = 'T';
	x[r+hlr][hlc + 5] = 'H';
	x[r+hlr][hlc + 6] = '=';
	/*x[r+hlr][hlc + 7] = 003;
	x[r+hlr][hlc + 8] = 003;
	x[r+hlr][hlc + 9] = 003;*/
	x[r+hlr][hlc + 12] = 'B';
	x[r+hlr][hlc + 13] = 'U';
	x[r+hlr][hlc + 14] = 'L';
	x[r+hlr][hlc + 15] = 'L';
	x[r+hlr][hlc + 16] = 'E';
	x[r+hlr][hlc + 17] = 'T';
	x[r+hlr][hlc + 18] = '=';
	if (reload == 5)
	{
		x[r + hlr][hlc + 19] = '5';
	}
	if (reload == 4)
	{
		x[r + hlr][hlc + 19] = '4';
	}
	if (reload == 3)
	{
		x[r + hlr][hlc + 19] = '3';
	}
	if (reload == 2)
	{
		x[r + hlr][hlc + 19] = '2';
	}
	if (reload == 1)
	{
		x[r + hlr][hlc + 19] = '1';
	}
	if (reload == 0)
	{
		x[r + hlr][hlc + 19] = '0';
	}
}
void draw_l1(char x[][150], int rl)
{
	for (int i = 1; i < 135; i++)
	{
		x[rl][i] = 205;
		x[rl+1][i] = 178;
		x[rl + 2][i] = 178;
		x[rl+3][i] = 205;
	}
	for (int i = 146; i < 149; i++)
	{
		x[rl][i] = 205;
		x[rl + 1][i] = 178;
		x[rl + 2][i] = 178;
		x[rl+3][i] = 205;
	}
}
void draw_l2(char x[][150], int rl)
{
	for (int i = 148; i > 13; i--)
	{
		x[rl][i] = 205;
		x[rl + 1][i] = 178;
		x[rl + 2][i] = 178;
		x[rl + 3][i] = 205;
	}
	for (int i = 3; i >= 1; i--)
	{
		x[rl][i] = 205;
		x[rl + 1][i] = 178;
		x[rl + 2][i] = 178;
		x[rl + 3][i] = 205;
	}

}
void draw_ladder(char x[][150], int rladder, int cladder, int rl)
{
	for (int i = rladder; i < rl; i++)
	{
		x[i][135] = '|';
		x[i][146] = '|';
		for (int c = cladder + 1; c < 146; c++)
		{
			x[i][c] = '-';
		}

	}
}
void draw_fire(char x[][150],int rfire,int cfire, int i)
{
	if (i % 2 == 0)
	{
		for (int i = cfire; i < 110; i += 4)
		{
			x[rfire - 1][i] = '(';
			x[rfire - 1][i + 1] = '_';
			x[rfire - 1][i + 2] = ',';
			x[rfire - 1][i + 3] = ')';
			x[rfire - 2][i + 1] = ')';
			x[rfire - 2][i + 2] = '(';
			x[rfire - 2][i + 3] = ',';
			x[rfire - 3][i + 2] = '.';
			x[rfire - 3][i + 1] = ')';
			x[rfire - 4][i + 2] = '(';
			x[rfire][i] = '^';
			x[rfire][i + 1] = '^';
			x[rfire][i + 2] = '^';
			x[rfire][i + 3] = '^';
		}
	}
	if (i % 2 != 0)
	{
		for (int i = cfire; i < 110; i += 4)
		{
			x[rfire - 1][i] = '(';
			x[rfire - 1][i + 1] = '_';
			x[rfire - 1][i + 2] = ',';
			x[rfire - 1][i + 3] = ')';
			x[rfire - 2][i + 1] = ')';
			x[rfire - 2][i + 2] = '(';
			x[rfire - 2][i + 3] = ',';
			x[rfire - 3][i + 2] = '(';
			x[rfire - 3][i + 1] = ',';
			x[rfire][i] = '^';
			x[rfire][i + 1] = '^';
			x[rfire][i + 2] = '^';
			x[rfire][i + 3] = '^';
		}
	}

}
void fire_kill_hero(char x[][150],int &rhero,int &chero)
{
	if (x[rhero + 1][chero] == ')' || x[rhero + 1][chero] == '(' || x[rhero + 1][chero] == '.' || x[rhero + 1][chero] == ',' || x[rhero + 1][chero + 1] == ')' || x[rhero + 1][chero + 1] == '(' || x[rhero + 1][chero + 1] == '.' || x[rhero + 1][chero + 1] == ','|| x[rhero + 1][chero+7] == ')' || x[rhero + 1][chero+7] == '(' || x[rhero + 1][chero+7] == '.' || x[rhero + 1][chero+7] == ',' || x[rhero + 1][chero + 8] == ')' || x[rhero + 1][chero + 8] == '(' || x[rhero + 1][chero + 8] == '.' || x[rhero + 1][chero + 8] == ',')
	{
		rhero = 24;
		chero = 2;
	}
}
void draw_slem(char x[][150],int rslem,int cslem)
{
	x[rslem][cslem] = 202;
	x[rslem - 1][cslem] = 201;
	x[rslem - 1][cslem+1] = 205;
	x[rslem-1][cslem+2] = 205;
	x[rslem - 1][cslem + 3] = 205;
	x[rslem - 1][cslem + 4] = 188;
	x[rslem - 2][cslem + 4] = 201;
	x[rslem - 2][cslem + 5] = 205;
	x[rslem - 2][cslem + 6] = 205;
	x[rslem - 2][cslem + 7] = 205;
	x[rslem - 2][cslem + 8] = 188;
	x[rslem - 3][cslem + 8] = 201;
	x[rslem - 3][cslem + 9] = 205;
	x[rslem - 3][cslem + 10] = 205;
	x[rslem - 3][cslem + 10] = 205;
	x[rslem - 3][cslem + 11] = 188;
	x[rslem-4 ][cslem + 11] = 201;
	x[rslem - 4][cslem + 12] = 205;
	x[rslem - 4][cslem + 13] = 205;
	x[rslem - 4][cslem + 14] = 187;
	for (int i = 3; i > 0; i--)
	{
		x[rslem - i][cslem+ 14] = 186;

	}
	x[rslem][cslem + 14] = 202;
}
void draw_slem_2(char x[][150],int rslem,int cslem)
{
	x[rslem][cslem] = 202;
	x[rslem - 1][cslem] = 186;
	x[rslem - 2][cslem] = 186;
	x[rslem - 3][cslem] = 201;
	x[rslem - 3][cslem + 1] = 205;
	x[rslem - 3][cslem + 2] = 205;
	x[rslem - 3][cslem + 3] =187;
	x[rslem - 2][cslem + 3] = 200;
	x[rslem - 2][cslem + 4] = 205;
	x[rslem - 2][cslem + 5] = 187;
	x[rslem - 1][cslem + 5] = 200;
	x[rslem - 1][cslem + 6] = 205;
	x[rslem -1][cslem + 7] = 187;
	x[rslem ][cslem + 7] = 202;
}
void draw_selim(char x[][150], int rselim, int cselim)
{
	x[rselim][cselim] = 200;
	x[rselim][cselim + 1] = 205;
	x[rselim][cselim + 2] = 205;
	x[rselim][cselim + 3] = 205;
	x[rselim][cselim + 4] = 205;
	x[rselim][cselim + 5] = 205;
	x[rselim][cselim + 6] = 205;
	x[rselim][cselim + 7] = 205;
	x[rselim][cselim + 8] = 205;
	x[rselim][cselim + 9] = 205;
	x[rselim][cselim + 10] = 205;
	x[rselim][cselim + 11] = 188;
	x[rselim-1][cselim] = 201;
	x[rselim-1][cselim + 1] = '=';
	x[rselim-1][cselim + 2] = '=';
	x[rselim-1][cselim + 3] = '=';
	x[rselim-1][cselim + 4] = '=';
	x[rselim-1][cselim + 5] = '=';
	x[rselim-1][cselim + 6] = '=';
	x[rselim-1][cselim + 7] = '=';
	x[rselim-1][cselim + 8] = '=';
	x[rselim-1][cselim + 9] = '=';
	x[rselim-1][cselim + 10] = '=';
	x[rselim-1][cselim + 11] = 187;
}
void move_hero_on_platform(char x[][150], int& dir, int& rhero, int& chero)
{

	if (x[rhero + 1][chero + 1] == '=' || x[rhero + 1][chero] == '=' || x[rhero + 1][chero + 2] == '=' || x[rhero + 1][chero + 3] == '=' || x[rhero + 1][chero + 4] == '=' || x[rhero + 1][chero + 5] == '=')
	{
		if (dir == 1)
		{
			chero++;
		}
		if (dir == -1)
		{
			chero--;
		}
	}
}
void move_selim(char x[][150], int& rselim, int& cselim, int& dirs)
{
	if (dirs == 1)
	{
		if (cselim + 5 == 110)
		{
			dirs = -1;
		}
	}
	if (dirs == -1)
	{
		if (cselim == 38)
		{
			dirs = 1;
		}
	}
	cselim += dirs;
}
void draw_zomie(char x[][150], int rzombie, int czombie, int dirz, int zombieh)
{
	if (zombieh > 0)
	{
		if (dirz == -1)
		{
			x[rzombie][czombie] = '|';
			x[rzombie][czombie - 1] = '\\';
			x[rzombie][czombie - 4] = '|';
			x[rzombie][czombie - 5] = '\\';
			x[rzombie - 1][czombie - 1] = '\\';
			x[rzombie - 1][czombie - 2] = '\\';
			x[rzombie - 1][czombie - 4] = '/';
			x[rzombie - 1][czombie - 5] = '/';
			x[rzombie - 2][czombie - 1] = '|';
			x[rzombie - 2][czombie - 2] = '|';
			x[rzombie - 2][czombie - 3] = '/';
			x[rzombie - 2][czombie - 4] = '/';
			x[rzombie - 2][czombie - 5] = '/';
			x[rzombie - 2][czombie - 6] = '|';
			x[rzombie - 2][czombie - 7] = '/';
			x[rzombie - 2][czombie - 8] = '|';
			x[rzombie - 3][czombie - 1] = '|';
			x[rzombie - 3][czombie - 5] = '/';
			x[rzombie - 3][czombie - 6] = '/';
			x[rzombie - 3][czombie - 7] = '/';
			x[rzombie - 3][czombie - 8] = '/';
			x[rzombie - 4][czombie - 1] = '|';
			x[rzombie - 4][czombie - 5] = '|';
			x[rzombie - 4][czombie - 6] = '|';
			x[rzombie - 4][czombie - 7] = '\\';
			x[rzombie - 5][czombie - 2] = '\\';
			x[rzombie - 5][czombie - 7] = '/';
			x[rzombie - 5][czombie - 8] = '\\';
			x[rzombie - 6][czombie - 3] = '\\';
			x[rzombie - 6][czombie - 8] = 232;
			x[rzombie - 6][czombie - 9] = '\\';
			x[rzombie - 7][czombie - 4] = '_';
			x[rzombie - 7][czombie - 5] = '\\';
			x[rzombie - 7][czombie - 9] = '/';
			x[rzombie - 8][czombie - 6] = '_';
			x[rzombie - 8][czombie - 7] = '_';
			x[rzombie - 8][czombie - 8] = '_';
			for (int i = 0; i < zombieh; i++)
			{
				x[rzombie - 9][czombie - 5 - i] = 254;
			}
		}
		if (dirz == 1)
		{
			x[rzombie][czombie] = '|';
			x[rzombie][czombie + 1] = '/';
			x[rzombie][czombie + 4] = '|';
			x[rzombie][czombie + 5] = '/';
			x[rzombie - 1][czombie + 1] = '/';
			x[rzombie - 1][czombie + 2] = '/';
			x[rzombie - 1][czombie + 4] = '/';
			x[rzombie - 1][czombie + 5] = '/';
			x[rzombie - 2][czombie + 1] = '|';
			x[rzombie - 2][czombie + 2] = '|';
			x[rzombie - 2][czombie + 3] = '\\';
			x[rzombie - 2][czombie + 4] = '\\';
			x[rzombie - 2][czombie + 5] = '\\';
			x[rzombie - 2][czombie + 6] = '|';
			x[rzombie - 2][czombie + 7] = '\\';
			x[rzombie - 2][czombie + 8] = '|';
			x[rzombie - 3][czombie + 1] = '|';
			x[rzombie - 3][czombie + 5] = '\\';
			x[rzombie - 3][czombie + 6] = '\\';
			x[rzombie - 3][czombie + 7] = '\\';
			x[rzombie - 3][czombie + 8] = '\\';
			x[rzombie - 4][czombie + 1] = '|';
			x[rzombie - 4][czombie + 5] = '|';
			x[rzombie - 4][czombie + 6] = '|';
			x[rzombie - 4][czombie + 7] = '\\';
			x[rzombie - 5][czombie + 2] = '/';
			x[rzombie - 5][czombie + 7] = '\\';
			x[rzombie - 5][czombie + 8] = '/';
			x[rzombie - 6][czombie + 3] = '/';
			x[rzombie - 6][czombie + 8] = 232;
			x[rzombie - 6][czombie + 9] = '/';
			x[rzombie - 7][czombie + 4] = '_';
			x[rzombie - 7][czombie + 5] = '/';
			x[rzombie - 7][czombie + 9] = '\\';
			x[rzombie - 8][czombie + 6] = '_';
			x[rzombie - 8][czombie + 7] = '_';
			x[rzombie - 8][czombie + 8] = '_';
			for (int i = 0; i < zombieh; i++)
			{
				x[rzombie - 9][czombie + 5 + i] = 254;

			}
		}
	}
}
void draw_hero(char x[][150], int rhero, int chero, int gunf, int direh)
{
	if (gunf == 0)
	{
		x[rhero][chero] = '(';
		x[rhero][chero + 1] = '_';
		x[rhero][chero + 2] = '_';
		x[rhero][chero + 3] = '|';
		x[rhero][chero + 5] = '|';
		x[rhero][chero + 7] = '_';
		x[rhero][chero + 6] = '_';
		x[rhero][chero + 8] = ')';
		x[rhero - 1][chero + 1] = '_';
		x[rhero - 1][chero + 2] = '|';
		x[rhero - 1][chero + 3] = '|';
		x[rhero - 1][chero + 5] = '|';
		x[rhero - 1][chero + 6] = '|';
		x[rhero - 1][chero + 7] = '_';
		x[rhero - 2][chero + 2] = '(';
		x[rhero - 2][chero + 3] = '|';
		x[rhero - 2][chero + 5] = '|';
		x[rhero - 2][chero + 6] = ')';
		x[rhero - 3][chero + 1] = '<';
		x[rhero - 3][chero + 2] = '|';
		x[rhero - 3][chero + 3] = '|';
		x[rhero - 3][chero + 4] = '^';
		x[rhero - 3][chero + 5] = '|';
		x[rhero - 3][chero + 6] = '|';
		x[rhero - 3][chero + 7] = '>';
		x[rhero - 4][chero] = '\\';
		x[rhero - 4][chero + 1] = '\\';
		x[rhero - 4][chero + 2] = '|';
		x[rhero - 4][chero + 3] = '=';
		x[rhero - 4][chero + 4] = '=';
		x[rhero - 4][chero + 5] = '=';
		x[rhero - 4][chero + 6] = '|';
		x[rhero - 4][chero + 7] = '/';
		x[rhero - 4][chero + 8] = '/';
		x[rhero - 5][chero] = '/';
		x[rhero - 5][chero + 1] = '/';
		x[rhero - 5][chero + 2] = '|';
		x[rhero - 5][chero + 4] = 237;
		x[rhero - 5][chero + 6] = '|';
		x[rhero - 5][chero + 7] = '\\';
		x[rhero - 5][chero + 8] = '\\';
		x[rhero - 6][chero + 1] = '_';
		x[rhero - 6][chero + 2] = '_';
		x[rhero - 6][chero + 4] = '_';
		x[rhero - 6][chero + 6] = '_';
		x[rhero - 6][chero + 7] = '_';
		x[rhero - 6][chero + 3] = '`';
		x[rhero - 6][chero + 5] = ',';
		x[rhero - 7][chero + 2] = '\\';
		x[rhero - 7][chero + 4] = '=';
		x[rhero - 7][chero + 6] = '/';
		x[rhero - 8][chero + 2] = '/';
		x[rhero - 8][chero + 3] = 'e';
		x[rhero - 8][chero + 5] = 'e';
		x[rhero - 8][chero + 6] = '\\';
		x[rhero - 9][chero + 3] = '.';
		x[rhero - 9][chero + 4] = '"';
		x[rhero - 9][chero + 5] = '.';
	}
	if (gunf == 1)
	{
		if (direh == 0)
		{
			x[rhero][chero] = '(';
			x[rhero][chero + 1] = '_';
			x[rhero][chero + 2] = '_';
			x[rhero][chero + 3] = '|';
			x[rhero][chero + 5] = '|';
			x[rhero][chero + 7] = '_';
			x[rhero][chero + 6] = '_';
			x[rhero][chero + 8] = ')';
			x[rhero - 1][chero + 1] = '_';
			x[rhero - 1][chero + 2] = '|';
			x[rhero - 1][chero + 3] = '|';
			x[rhero - 1][chero + 5] = '|';
			x[rhero - 1][chero + 6] = '|';
			x[rhero - 1][chero + 7] = '_';
			x[rhero - 2][chero + 2] = '(';
			x[rhero - 2][chero + 3] = '|';
			x[rhero - 2][chero + 5] = '|';
			x[rhero - 2][chero + 6] = ')';
			x[rhero - 3][chero + 1] = '<';
			x[rhero - 3][chero + 2] = '|';
			x[rhero - 3][chero + 3] = '|';
			x[rhero - 3][chero + 4] = '^';
			x[rhero - 3][chero + 5] = '|';
			x[rhero - 3][chero + 6] = '|';
			x[rhero - 4][chero] = '\\';
			x[rhero - 4][chero + 1] = '\\';
			x[rhero - 4][chero + 2] = '|';
			x[rhero - 4][chero + 3] = '=';
			x[rhero - 4][chero + 4] = '=';
			x[rhero - 4][chero + 5] = '=';
			x[rhero - 4][chero + 6] = '|';
			x[rhero - 5][chero] = '/';
			x[rhero - 5][chero + 1] = '/';
			for (int i = 0; i < 4; i++)
			{
				x[rhero - 5][chero + 7 + i] = '-';
			}
			x[rhero - 5][chero + 2] = '|';
			x[rhero - 5][chero + 4] = 237;
			x[rhero - 5][chero + 6] = '|';
			x[rhero - 6][chero + 1] = '_';
			x[rhero - 6][chero + 2] = '_';
			x[rhero - 6][chero + 4] = '_';
			x[rhero - 6][chero + 6] = '_';
			x[rhero - 6][chero + 7] = '_';
			x[rhero - 6][chero + 8] = '_';
			x[rhero - 6][chero + 9] = '_';
			x[rhero - 5][chero + 10] = '/';
			for (int i = 0; i < 1; i++)
			{
				x[rhero - 4][chero + 10 + i] = '"';
			}
			x[rhero - 5][chero + 11] = '/';
			for (int i = 0; i < 4; i++)
			{
				x[rhero - 6][chero + 11 + i] = '_';
			}
			x[rhero - 5][chero + 14] = 217;
			for (int i = 0; i < 2; i++)
			{
				x[rhero - 5][chero + 12 + i] = '-';
			}
			x[rhero - 6][chero + 3] = '`';
			x[rhero - 6][chero + 5] = ',';
			x[rhero - 7][chero + 2] = '\\';
			x[rhero - 7][chero + 4] = '=';
			x[rhero - 7][chero + 6] = '/';
			x[rhero - 8][chero + 2] = '/';
			x[rhero - 8][chero + 3] = 'e';
			x[rhero - 8][chero + 5] = 'e';
			x[rhero - 8][chero + 6] = '\\';
			x[rhero - 9][chero + 3] = '.';
			x[rhero - 9][chero + 4] = '"';
			x[rhero - 9][chero + 5] = '.';
		}
		if (direh == 1)
		{
			x[rhero][chero] = ')';
			x[rhero][chero - 1] = '_';
			x[rhero][chero - 2] = '_';
			x[rhero][chero - 3] = '|';
			x[rhero][chero - 5] = '|';
			x[rhero][chero - 7] = '_';
			x[rhero][chero - 6] = '_';
			x[rhero][chero - 8] = '(';
			x[rhero - 1][chero - 1] = '_';
			x[rhero - 1][chero - 2] = '|';
			x[rhero - 1][chero -3] = '|';
			x[rhero - 1][chero - 5] = '|';
			x[rhero - 1][chero - 6] = '|';
			x[rhero - 1][chero - 7] = '_';
			x[rhero - 2][chero - 2] = ')';
			x[rhero - 2][chero - 3] = '|';
			x[rhero - 2][chero - 5] = '|';
			x[rhero - 2][chero - 6] = '(';
			x[rhero - 3][chero - 1] = '>';
			x[rhero - 3][chero - 2] = '|';
			x[rhero - 3][chero - 3] = '|';
			x[rhero - 3][chero - 4] = '^';
			x[rhero - 3][chero - 5] = '|';
			x[rhero - 3][chero - 6] = '|';
			x[rhero - 4][chero]= '/';
			x[rhero - 4][chero - 1] = '/';
			x[rhero - 4][chero - 2] = '|';
			x[rhero - 4][chero - 3] = '=';
			x[rhero - 4][chero - 4] = '=';
			x[rhero - 4][chero - 5] = '=';
			x[rhero - 4][chero - 6] = '|';
			x[rhero - 5][chero]= '\\';
			x[rhero - 5][chero - 1] = '\\';
			for (int i = 0; i < 4; i++)
			{
				x[rhero - 5][chero  -7 - i] = '-';
			}
			x[rhero - 5][chero -2] = '|';
			x[rhero - 5][chero - 4] = 237;
			x[rhero - 5][chero - 6] = '|';
			x[rhero - 6][chero - 1] = '_';
			x[rhero - 6][chero - 2] = '_';
			x[rhero - 6][chero - 4] = '_';
			x[rhero - 6][chero - 6] = '_';
			x[rhero - 6][chero - 7] = '_';
			x[rhero - 6][chero - 8] = '_';
			x[rhero - 6][chero - 9] = '_';
			x[rhero - 5][chero - 10] = '\\';
			for (int i = 0; i < 1; i++)
			{
				x[rhero - 4][chero - 10 - i] = '"';
			}
			x[rhero - 5][chero - 11] = '\\';
			for (int i = 0; i < 4; i++)
			{
				x[rhero - 6][chero - 11 - i] = '_';
			}
			x[rhero - 5][chero - 14] = 217;
			for (int i = 0; i < 2; i++)
			{
				x[rhero - 5][chero - 12 - i] = '-';
			}
			x[rhero - 6][chero - 3] = '`';
			x[rhero - 6][chero - 5] = ',';
			x[rhero - 7][chero - 2] = '/';
			x[rhero - 7][chero - 4] = '=';
			x[rhero - 7][chero - 6] = '\\';
			x[rhero - 8][chero - 2] = '\\';
			x[rhero - 8][chero - 3] = 'a';
			x[rhero - 8][chero - 5] = 'a';
			x[rhero - 8][chero - 6] = '/';
			x[rhero - 9][chero - 3] = '.';
			x[rhero - 9][chero - 4] = '"';
			x[rhero - 9][chero - 5] = '.';
		}
	}
}
void move_hero(char x[][150], char dirh, int& rhero, int& chero, int& gunf, int fjump,int& r,int &direh,int jumpct)
{
	int posr = 7;
	int posc = 1;
	int flag = 1;
	if (dirh == 'd')
	{
		direh = 0;
		if (x[rhero][chero + 9] == ' ' || x[rhero][chero + 9] == '|' || x[rhero][chero + 9] == '-')
		{
			chero++;

		}
		
		if (x[rhero - 1][chero + 5] == 'O')
		{

			gunf = 1;
			x[6][10] = ' ';
		}
	}
	if (dirh == 'a')
	{
		if (x[rhero][chero - 1] == ' ' || x[rhero][chero - 1] == '|' || x[rhero][chero - 1] == '-')
		{
			chero--;

		}
		dirh = 1;
	}
	if (fjump == 0)
	{
		if (dirh == 'q')
		{
			if (jumpct > 0)
			{
				if (x[rhero - 10][chero - 2] == ' ' || x[rhero - 10][chero - 2] == '|' || x[rhero - 10][chero - 2] == '-')
				{
					rhero --;
					chero -= 2;
					if (r > 0)
					{
						r--;
					}
				}
			}
		}
		if (dirh == 'e')
		{
			if (jumpct > 0)
			{
				if (x[rhero - 10][chero + 6] == ' ' || x[rhero - 10][chero + 6] == '|' || x[rhero - 10][chero + 6] == '-')
				{

					rhero --;
					chero += 2;
					if (r > 0)
					{
						r--;
					}


				}
			}

		}
		if (dirh == 'w')
		{
			if (jumpct > 0)
			{
				if (x[rhero - 10][chero] == ' ')//|| x[rhero + 3][chero] == '-')
				{
					rhero --;
					if (r > 0)
					{
						r--;
					}

				}
			}

		}
	}
	if (dirh == 's')
	{
		if (x[rhero + 1][chero] == '-')
		{
			rhero++;
			if (r < 200)
			{
				r++;
			}
		}
	}

}
void _gravity(char x[][150], int& rhero, int& chero, int& fjump,int& r,int jumpct)
{
	if (x[rhero + 1][chero] == ' ' && x[rhero + 1][chero + 1] == ' ' && x[rhero + 1][chero + 2] == ' ')
	{
		if (jumpct == 0)
		{
			rhero++;
			r++;
			fjump = 0;
		}
	}
	if (x[rhero + 1][chero] != ' ' && x[rhero + 1][chero + 1] != ' ' && x[rhero + 1][chero + 2] != ' ')
	{
		fjump = 0;
	}

}
void move_zombie(char x[][150],int rzombie ,int& czombie, int& dirz)
{
	if (dirz == 1)
	{
		if (czombie + 24 == 148)//||x[rzombie-7][czombie+10]!=' ')
		{
			dirz = -1;
		}
	}
	if (dirz == -1)
	{
		if (czombie == 20) //|| x[rzombie - 7][czombie - 10] != ' ')
		{
			dirz = 1;
		}
	}
	czombie += dirz;
}
void draw_laser_machine(char x[][150], int rlaser, int claser,int ctflag)
{
	if (ctflag == 1)
	{

		for (int i = 0; i < 2; i++)
		{
			x[rlaser][claser + i] = '_';
		}
		x[rlaser + 1][claser + 2] = '\\';
		x[rlaser + 1][claser + 3] = '_';
		x[rlaser + 2][claser + 4] = '|';
		x[rlaser + 2][claser + 5] = '_';
		for (int i = 0; i < 3; i++)
		{
			x[rlaser + 3 + i][claser + 6] = '|';
		}
		x[rlaser + 6][claser + 7] = '\\';
		x[rlaser + 7][claser + 8] = '\\';
		x[rlaser + 8][claser + 8] = '/';
		x[rlaser + 9][claser + 7] = '/';
		for (int i = 0; i < 3; i++)
		{
			x[rlaser + 10 + i][claser + 6] = '|';
		}
		x[rlaser + 12][claser + 5] = '_';
		x[rlaser + 13][claser + 4] = '|';
		x[rlaser + 13][claser + 3] = '_';
		x[rlaser + 14][claser + 2] = '/';
		for (int i = 0; i < 2; i++)
		{
			x[rlaser + 15][claser + i] = '_';
		}
	}
	if (ctflag == 0)
	{
		for (int i = 0; i < 2; i++)
		{
			x[rlaser][claser + i] = '_';
		}
		x[rlaser + 1][claser + 2] = '\\';
		x[rlaser + 1][claser + 3] = '_';
		x[rlaser + 2][claser + 4] = '|';
		x[rlaser + 2][claser + 5] = '_';
		for (int i = 0; i < 3; i++)
		{
			x[rlaser + 3 + i][claser + 6] = '|';
		}
		x[rlaser + 5][claser + 7] = '_';
		x[rlaser + 5][claser + 8] = '_';
		x[rlaser + 9][claser + 8] = '_';
		x[rlaser + 9][claser + 7] = '_';
		for (int i = 0; i < 3; i++)
		{
			x[rlaser + 10 + i][claser + 6] = '|';
		}
		x[rlaser + 12][claser + 5] = '_';
		x[rlaser + 13][claser + 4] = '|';
		x[rlaser + 13][claser + 3] = '_';
		x[rlaser + 14][claser + 2] = '/';
		for (int i = 0; i < 2; i++)
		{
			x[rlaser + 15][claser + i] = '_';
		}
	}
}
void draw_laser(char x[][150], int rlaser, int claser,int ctflag,int &ct)
{
	if (ctflag == 0)
	{
		for (int i = 0; i < 140; i++)
		{
			x[rlaser + 7][claser + i] = 183;
			x[rlaser + 8][claser + i] = 189;
		}
		ct++;
	}
}
void draw_traps(char x[][150],int rtraps,int ctraps,int ctflag)
{
	if (ctflag == 1)
	{
		for (int i = 0; i < 5; i++)
		{
			x[rtraps][ctraps + i] = 193;
		}
	}
}
void draw_enemy(char x[][150], int& enemyr, int& enemyc,int dire)
{
	if (dire == -1)
	{
		x[enemyr - 1][enemyc - 1] = '(';
		for (int i = 0; i < 7; i++)
		{
			x[enemyr - 1][enemyc + i] = '0';
		}
		x[enemyr - 1][enemyc + 7] = ')';
		x[enemyr - 2][enemyc + 1] = '(';
		x[enemyr - 2][enemyc + 2] = '_';
		x[enemyr - 2][enemyc + 3] = '|';
		x[enemyr - 2][enemyc + 4] = '_';
		x[enemyr - 2][enemyc + 5] = ')';
		x[enemyr - 3][enemyc + 2] = '/';
		x[enemyr - 3][enemyc + 3] = '|';
		x[enemyr - 3][enemyc + 4] = '\\';
		x[enemyr - 4][enemyc + 2] = '_';
		x[enemyr - 4][enemyc + 1] = '\\';
		x[enemyr - 4][enemyc + 3] = 'I';
		x[enemyr - 4][enemyc + 4] = '_';
		x[enemyr - 4][enemyc + 5] = '/';
		x[enemyr - 5][enemyc + 1] = '____';
		x[enemyr - 5][enemyc + 2] = '___';
		x[enemyr - 5][enemyc + 4] = '____';
		x[enemyr - 5][enemyc + 5] = '__';
		x[enemyr - 5][enemyc + 3] = '.';
		x[enemyr - 5][enemyc] = '|';
		x[enemyr - 5][enemyc + 6] = '|';
		for (int i = 0; i < 7; i++)
		{
			x[enemyr - 6][enemyc + i] = '_';
		}
		x[enemyr - 6][enemyc - 1] = '\\';
		x[enemyr - 6][enemyc - 2] = '/';
		x[enemyr - 6][enemyc - 3] = '/';
		x[enemyr - 6][enemyc + 7] = '/';
		x[enemyr - 6][enemyc + 8] = '\\';
		x[enemyr - 6][enemyc + 9] = '\\';
		x[enemyr - 7][enemyc + 8] = '__';
		x[enemyr - 7][enemyc + 7] = '\\';
		x[enemyr - 7][enemyc + 9] = ')';
		x[enemyr - 7][enemyc - 1] = '/';
		x[enemyr - 7][enemyc - 2] = '__';
		x[enemyr - 7][enemyc - 3] = '(';
		for (int i = 0; i < 3; i++)
		{
			x[enemyr - 8][enemyc - 2 + i] = '_';
		}
		x[enemyr - 8][enemyc + 1] = '|';
		x[enemyr - 8][enemyc + 2] = '0';
		x[enemyr - 8][enemyc + 4] = '0';
		x[enemyr - 8][enemyc + 5] = '|';
		for (int i = 0; i < 3; i++)
		{
			x[enemyr - 8][enemyc + 6 + i] = '_';
		}
		x[enemyr - 9][enemyc + 5] = '.';
		x[enemyr - 9][enemyc + 1] = '.';
		x[enemyr - 9][enemyc + 2] = '`';
		x[enemyr - 10][enemyc + 3] = '__';
		x[enemyr - 9][enemyc + 4] = '`';
		x[enemyr - 5][enemyc + 8] = '<';
		x[enemyr - 5][enemyc + 10] = '>';
		x[enemyr - 4][enemyc + 8] = '/';
		x[enemyr - 4][enemyc + 9] = '/';
		x[enemyr - 3][enemyc + 8] = '^';
		x[enemyr - 3][enemyc + 9] = '^';
		x[enemyr - 5][enemyc - 3] = '/';
		x[enemyr - 5][enemyc - 4] = '\\';
		x[enemyr - 6][enemyc - 4] = '\\';
		x[enemyr - 6][enemyc - 5] = '\\';
		x[enemyr - 7][enemyc - 5] = ']';
		x[enemyr - 7][enemyc - 6] = '>';
	}
	if (dire == 1)
	{
		x[enemyr - 1][enemyc + 1] = ')';
		for (int i = 0; i < 7; i++)
		{
			x[enemyr - 1][enemyc - i] = '0';
		}
		x[enemyr - 1][enemyc - 7] = '(';
		x[enemyr - 2][enemyc - 1] = ')';
		x[enemyr - 2][enemyc - 2] = '_';
		x[enemyr - 2][enemyc - 3] = '|';
		x[enemyr - 2][enemyc - 4] = '_';
		x[enemyr - 2][enemyc - 5] = '(';
		x[enemyr - 3][enemyc - 2] = '\\';
		x[enemyr - 3][enemyc - 3] = '|';
		x[enemyr - 3][enemyc - 4] = '/';
		x[enemyr - 4][enemyc - 2] = '_';
		x[enemyr - 4][enemyc - 1] = '/';
		x[enemyr - 4][enemyc - 3] = 'I';
		x[enemyr - 4][enemyc - 4] = '_';
		x[enemyr - 4][enemyc - 5] = '\\';
		x[enemyr - 5][enemyc - 1] = '____';
		x[enemyr - 5][enemyc - 2] = '___';
		x[enemyr - 5][enemyc - 4] = '____';
		x[enemyr - 5][enemyc - 5] = '__';
		x[enemyr - 5][enemyc - 3] = '.';
		x[enemyr - 5][enemyc]= '|';
		x[enemyr - 5][enemyc - 6] = '|';
		for (int i = 0; i < 7; i++)
		{
			x[enemyr - 6][enemyc - i] = '_';
		}
		x[enemyr - 6][enemyc + 1] = '/';
		x[enemyr - 6][enemyc + 2] = '\\';
		x[enemyr - 6][enemyc + 3] = '\\';
		x[enemyr - 6][enemyc - 7] = '\\';
		x[enemyr - 6][enemyc - 8] = '/';
		x[enemyr - 6][enemyc - 9] = '/';
		x[enemyr - 7][enemyc - 8] = '__';
		x[enemyr - 7][enemyc - 7] = '/';
		x[enemyr - 7][enemyc - 9] = '(';
		x[enemyr - 7][enemyc + 1] = '\\';
		x[enemyr - 7][enemyc + 2] = '__';
		x[enemyr - 7][enemyc + 3] = ')';
		for (int i = 0; i < 3; i++)
		{
			x[enemyr - 8][enemyc + 2 - i] = '_';
		}
		x[enemyr - 8][enemyc - 1] = '|';
		x[enemyr - 8][enemyc - 2] = '0';
		x[enemyr - 8][enemyc - 4] = '0';
		x[enemyr - 8][enemyc - 5] = '|';
		for (int i = 0; i < 3; i++)
		{
			x[enemyr - 8][enemyc - 6 - i] = '_';
		}
		x[enemyr - 9][enemyc - 5] = '.';
		x[enemyr - 9][enemyc - 1] = '.';
		x[enemyr - 9][enemyc - 2] = '`';
		x[enemyr - 10][enemyc - 3] = '__';
		x[enemyr - 9][enemyc - 4] = '`';
		x[enemyr - 5][enemyc - 8] = '>';
		x[enemyr - 5][enemyc - 10] = '<';
		x[enemyr - 4][enemyc - 8] = '\\';
		x[enemyr - 4][enemyc - 9] = '\\';
		x[enemyr - 3][enemyc - 8] = '^';
		x[enemyr - 3][enemyc - 9] = '^';
		x[enemyr - 5][enemyc + 3] = '\\';
		x[enemyr - 5][enemyc + 4] = '/';
		x[enemyr - 6][enemyc + 4] = '/';
		x[enemyr - 6][enemyc + 5] = '/';
		x[enemyr - 7][enemyc+  5] = '[';
		x[enemyr - 7][enemyc+ 6] = '<';
	}
}
void move_enemy(char x[][150], int& enemyr, int& enemyc, int& dire, int enemystop)
{
	if (enemystop == 0)
	{
		if (dire == 1)
		{
			if (enemyc == 130) //|| x[enemyr][enemyc + 5] != ' ')
			{
				dire = -1;
			}
		}
		if (dire == -1)
		{
			if (enemyc == 15)//|| x[enemyr][enemyc - 5] != ' ')
			{
				dire = 1;
			}
		}
		enemyc += dire;
	}
}
void draw_bullet(char x[][150], int& gunf, int& bulletf, int bullet[], int h, int gunct, int bullethit[], int b, int hit)
{
	int i = 0;
	if (bulletf == 1)
	{
		/*if (gunct < 5)
		{
		 x[bullet[b+i]][bullet[b + gunct+i]] = 'o';
		 i += 2;
		}*/
		if (bullethit[hit + 0] != 1)
		{
			if (gunct >= 1)
			{

				x[bullet[b]][bullet[b + 1]] = 'o';
			}
		}
		if (bullethit[hit + 1] != 1)
		{
			if (gunct >= 2)
			{
				x[bullet[b + 2]][bullet[b + 3]] = 'o';
			}
		}
		if (bullethit[hit + 2] != 1)
		{
			if (gunct >= 3)
			{
				x[bullet[b + 4]][bullet[b + 5]] = 'o';
			}
		}
		if (bullethit[hit + 3] != 1)
		{
			if (gunct >= 4)
			{
				x[bullet[b + 6]][bullet[b + 7]] = 'o';
			}
		}
		if (bullethit[hit + 4] != 1)
		{
			if (gunct >= 5)
			{
				x[bullet[b + 8]][bullet[b + 9]] = 'o';
			}
		}
	}
}
void move_bullet(char x[][150], int& bulletf, int bullet[], int gunct, int bullethit[], int direh, int bulletmove[], int b, int hit)
{
	if (direh == 0)
	{
		if (bulletf == 1)
		{
			if (gunct >= 1)
			{
				if (x[bullet[b + 0]][bullet[b + 1]] == ' ')
				{
					bullet[b + 0] = bullet[b + 1] + bulletmove[hit + 0];
				}
				else
				{
					bullethit[hit + 0] = 1;
				}
			}
			if (gunct >= 2)
			{
				if (x[bullet[b + 2]][bullet[b + 3]] == ' ')
				{
					bullet[b + 3] = bullet[b + 3] + bulletmove[hit + 1];
				}
				else
				{
					bullethit[hit + 1] = 1;
				}
			}
			if (gunct >= 3)
			{
				if (x[bullet[b + 4]][bullet[b + 5]] == ' ')
				{
					bullet[b + 5] = bullet[b + 5] + bulletmove[hit + 2];
				}
				else
				{
					bullethit[hit + 2] = 1;
				}
			}
			if (gunct >= 4)
			{
				if (x[bullet[b + 6]][bullet[b + 7]] == ' ')
				{
					bullet[b + 7] = bullet[b + 7] + bulletmove[hit + 3];
				}
				else
				{
					bullethit[hit + 3] = 1;
				}
			}
			if (gunct >= 5)
			{
				if (x[bullet[b + 8]][bullet[b + 9]] == ' ')
				{
					bullet[b + 9] = bullet[b + 9] + bulletmove[hit + 4];
				}
				else
				{
					bullethit[hit + 4] = 1;
				}
			}


		}
	}
	if (direh == 1)
	{
		if (bulletf == 1)
		{
			if (gunct >= 1)
			{
				if (x[bullet[b + 0]][bullet[b + 1]] == ' ')
				{
					bullet[b + 1] = bullet[b + 1] + bulletmove[hit + 0];
				}
				else
				{
					bullethit[hit + 0] = 1;
				}
			}
			if (gunct >= 2)
			{
				if (x[bullet[b + 2]][bullet[b + 3]] == ' ')
				{
					bullet[3] = bullet[3] + bulletmove[hit + 1];
				}
				else
				{
					bullethit[hit + 1] = 1;
				}
			}
			if (gunct >= 3)
			{
				if (x[bullet[b + 4]][bullet[b + 5]] == ' ')
				{
					bullet[b + 5] = bullet[b + 5] + bulletmove[hit + 2];
				}
				else
				{
					bullethit[hit + 2] = 1;
				}
			}
			if (gunct >= 4)
			{
				if (x[bullet[b + 6]][bullet[b + 7]] == ' ')
				{
					bullet[b + 7] = bullet[b + 7] + bulletmove[hit + 3];
				}
				else
				{
					bullethit[hit + 3] = 1;
				}
			}
			if (gunct >= 5)
			{
				if (x[bullet[b + 8]][bullet[b + 9]] == ' ')
				{
					bullet[b + 9] = bullet[b + 9] + bulletmove[hit + 4];
				}
				else
				{
					bullethit[hit + 4] = 1;
				}
			}


		}
	}
}
void bullet_kill_zombie(char x[][150], int czombie, int rzombie, int &zhealth, int rhero)
{
	if (rhero == rzombie)
	{
		if (x[rzombie - 5][czombie + 9] == 'o' || x[rzombie -4][czombie] == 'o')
		{
			zhealth--;
		}
		if (x[rzombie -5][czombie + 9] == 'o' || x[rzombie - 4][czombie] == 'o')
		{
			zhealth--;
		}
	}

}
void main()
{
	char x[200][150];
	int l = 1;
	int r = 0;
	int c = 0;
	int hlr = 1;
	int hlc = 5;
	int rl = 25;
	int rl2 = 50;
	int rl3 = 75;
	int rl4 = 100;
	int rladder = 26;
	int cladder = 135;
	int rfire = 25;
	int cfire = 45;
	int rtraps1 = 100;
	int ctraps1 = 100;
	int rtraps2 = 100;
	int ctraps2 = 90;
	int rtraps3 = 100;
	int ctraps3 = 80;
	int rtraps4 = 100;
	int ctraps4 = 70;
	int rtraps5 = 100;
	int ctraps5 = 60;
	int rtraps6 = 100;
	int ctraps6 = 50;
	int enemyr = 75;
	int enemyc = 7;
	int rslem = 25;
	int cslem = 30;
	int rslem2 = 25;
	int cslem2 = 113;
	int rlaser = 80;
	int claser = 1;
	int rselim = 20;
	int cselim = 44;
	int dirs = 1;
	int rzombie = 49;
	int czombie = 50;
	int rzombie2 = 49;
	int czombie2 = 20;
	int rzombie3 = 49;
	int czombie3 = 80;
	int dirz1 = -1;
	int rhero = 24;
	int chero = 140;
	int gunf = 1;
	int direh=0;
	int fjump = 0;
	int ctflag = 0;
	int jumpct = 0;
	int ct = 50;
	char dirh;
	int dire = 1;
	int enemystop=0;
	int bulletf=0; 
	int bullet[1000]; 
	int gunct = 0;
	int bullethit[500]; 
	int bulletmove[500];
	int b=0;
	int hit=0;
	int h = 0;
	int reload = 5;
	int p = 0;
	int zombieh1 = 4;
	int zombieh2 = 4;
	int zombieh3 = 4;
	int dirz2 = 1;
	int dirz3 = 1;
	for (int ;;)
	{
		for (int i = 0; !_kbhit(); i++)
		{
			if (ct == 50)
			{
				ctflag = 1;
			}
			if (ct == 0)
			{
				ctflag = 0;
			}
			if (ctflag == 1)
			{
				ct--;
			}
			if (jumpct > 0)
			{
				jumpct--;
			}
			clean_and_draw_border(x, r, c);
			draw_stats(x, hlr, hlc, r, c,reload);
			draw_l1(x, rl);
			draw_l2(x, rl2);
			draw_l1(x, rl3);
			draw_l2(x, rl4);
			draw_ladder(x, rladder, cladder, rl2);
			draw_fire(x, rfire, cfire, i);
			draw_slem(x, rslem, cslem);
			draw_slem_2(x, rslem2, cslem2);
			draw_selim(x, rselim, cselim);
			move_selim(x, rselim, cselim, dirs);
			draw_zomie(x, rzombie, czombie, dirz1,zombieh1);
			move_zombie(x,rzombie,czombie, dirz1);
			draw_zomie(x, rzombie2, czombie2, dirz2, zombieh2);
			move_zombie(x,rzombie2,czombie2, dirz2);
			draw_zomie(x, rzombie3, czombie3, dirz3, zombieh3);
			move_zombie(x,rzombie3,czombie3, dirz3);
			draw_hero(x, rhero, chero, gunf, direh);
			_gravity(x, rhero, chero, fjump, r, jumpct);
			fire_kill_hero(x, rhero, chero);
			move_hero_on_platform(x, dirs, rhero, chero);
			move_enemy(x, enemyr, enemyc, dire, enemystop);
			draw_laser_machine(x, rlaser, claser, ctflag);
			draw_laser(x, rlaser, claser, ctflag, ct);
			draw_traps(x, rtraps1, ctraps1, ctflag);
			draw_traps(x, rtraps2, ctraps2, ctflag);
			draw_traps(x, rtraps3, ctraps3, ctflag);
			draw_traps(x, rtraps4, ctraps4, ctflag);
			draw_traps(x, rtraps5, ctraps5, ctflag);
			draw_traps(x, rtraps6, ctraps6, ctflag);
			draw_enemy(x, enemyr, enemyc,dire);
			move_bullet(x, bulletf, bullet, gunct, bullethit, direh, bulletmove, b, hit);
			draw_bullet(x, gunf, bulletf, bullet, h, gunct, bullethit, b, hit);
			bullet_kill_zombie(x,czombie,rzombie,zombieh1,rhero);
			bullet_kill_zombie(x, czombie2, rzombie2, zombieh2, rhero);
			bullet_kill_zombie(x, czombie3, rzombie3, zombieh3, rhero);
			if (jumpct > 0)
			{
				move_hero(x, dirh, rhero, chero, gunf, fjump, r, direh, jumpct);
			}
			cout_to_screen(x, l,r,c);
		}
		dirh = _getch();
		if (dirh == 'w')
		{
			jumpct = 5;
		}
		if (dirh == 'q')
		{
			jumpct = 5;
		}
		if (dirh == 'e')
		{
			jumpct = 5;
		}
		if (dirh == 'a')
		{
			direh = 1;
		}
		if (dirh == 'd')
		{
			direh = 0;
		}
		if (dirh == 'f')
		{
			if (reload > 0)
			{
				if (gunf == 1)
				{
					gunct++;
					bulletf = 1;
					reload--;
					if (direh == 0)
					{
						bullet[b + h] = rhero - 5;
						h++;
						bullet[b + h] = chero + 15;
						h++;
						bulletmove[hit + p] = 3;
						p++;
					}
					if (direh == 1)
					{
						bullet[b + h] = rhero - 5;
						h++;
						bullet[b + h] = chero - 15;
						h++;
						bulletmove[hit + p] = -3;
						p++;
					}
				}
			}
		}
		if (dirh == 'r')
		{
			reload = 5;
			b = b + 10;
			hit = hit + 5;
			gunct = 0;
			p = 0;
			h = 0;
		}
	    draw_bullet(x, gunf, bulletf, bullet, h, gunct, bullethit, b, hit);
		move_hero(x, dirh, rhero, chero,  gunf, fjump,r,direh,jumpct);
		draw_hero(x, rhero, chero, gunf, direh);
	}

}
Leave a Comment