The attachment preview is chopped off after the first 10 KB. Please download the entire file.

```
#include <fstream.h>
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include <time.h>
#include <math.h>
double level = 1.0; //Current level, may not nesessarily be loaded when you change level, be sure to run the changelevel function
int levelcolor = 11; //Color of the level(mostly terrain)
double gamespeed; //Changes the speed that the game moves, except the hero.
int mx=5; //Coordinates of the player, the coordinates go xy for the gotoxy function, and
int my=4; //they go yx when referring to position on the matrix.
int i, j; //Variables used when printing the levels.
char direction = '!'; //Variable that holds the key hit by the player when moving around normally
char facing = 'S'; //Variable that holds which direction the player is currently facing
char levelname[20];
char matrix[20][59]; //The 2D array that holds the level's terrain and position of player and monsters.
char choice = '!'; //Variable used when speaking with people to hold what key they hit.
int counter = 0; //Used to make monsters move while you are using sword
int peoplecolor = 14;
struct playerstats
{
char playername[11];
double swordspeed;
double health;
double totalhealth;
double swordpower;
double mana;
double maxmana;
char weaponj[15];
char weaponu[15];
char weapono[15];
char weaponl[15];
int swordcolor;
int playercolor;
int money;
int maxmoney;
int mx;
int my;
int lookdown;
int lookup;
int lookright;
int lookleft;
};
struct monstats //The stats of a monster, contains all information on the monster
{
int x; //X position of the monster on the screen, Y position on the Matrix
int y; //Y position of the monster on the screen, X position on the Matrix
int radius; //The radius around the monster that you want him to react to the main character(Not all AIs use this)
double health; //The health remaining for the monster
double armor; //Armor of the monster
double maxhealth; //The maximum amount of health the monster can have
int color; //The color of the monster
char look; //The symbol used for the monster
int move; //Direction randomized for the monster to move in
int lastmove; //The last direction moved by the monster
double speed;
double speedcounter;
int active; //Whether or not the current monster is active(0 or 1, 0 for nonmoving, 1 for moving)
int ai; //The current AI level of the monster, see AI functions for details on AIs
int skip; //Is used in AI to stop other loops from running, ignore it.
};
struct monster //The monsters themselves, not completely nessesary, but it creates 6 monsters with their own stats.
{
monstats one;
monstats two;
monstats three;
monstats four;
monstats five;
monstats six;
};
monster mon; //Six monsters that can be activated or deactivated in the game
playerstats stats;
void setcolor(int color) //Allows the changing of color for a single spot
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE );
SetConsoleTextAttribute(hOut, color);
}
void gotoxy(short x, short y) //Moves cursor to an XY position on the console
{
HANDLE hConsoleOutput;
COORD Cursor_an_Pos = {x,y};
hConsoleOutput = GetStdHandle (STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hConsoleOutput, Cursor_an_Pos);
}
void updatemapstats()
{
int xheart = 59;
int yheart = 2;
double health = floor(stats.health); //Returns number of full hearts
setcolor(15);
gotoxy(59, 1);
printf("Health: %.2f/%.2f", stats.health, stats.totalhealth);
setcolor(12);
while(health > 0)
{
gotoxy(xheart, yheart); //Prints out full hearts
putchar(3);
xheart++;
health--;
if(xheart == 79 && yheart != 3)
{
yheart++;
xheart = 59;
}
}
health = fmod((stats.health * 4), 4); //Returns 0-4, depending on how much of heart is left
gotoxy(59, 15);
if(health > 0 && health <= 1)
{ //If 1/4th of heart
gotoxy(xheart, yheart);
setcolor(4);
putchar(3);
xheart++;
if(xheart == 79 && yheart != 3)
{
yheart++;
xheart = 59;
}
}
if(health > 1 && health <= 2)
{
gotoxy(xheart, yheart);
setcolor(5);
putchar(3);
xheart++;
if(xheart == 79 && yheart != 3)
{
yheart++;
xheart = 59;
}
}
if(health > 2 && health <= 3)
{
gotoxy(xheart, yheart);
setcolor(13);
putchar(3);
xheart++;
if(xheart == 79 && yheart != 3)
{
yheart++;
xheart = 59;
}
}
if(health > 3)
{
gotoxy(xheart, yheart);
setcolor(12);
putchar(3);
xheart++;
if(xheart == 79 && yheart != 3)
{
yheart++;
xheart = 59;
}
}
health = floor(stats.totalhealth - stats.health);
while(health > 0)
{
gotoxy(xheart, yheart);
setcolor(1);
putchar(3);
health--;
xheart++;
if(xheart == 79 && yheart != 3)
{
yheart++;
xheart = 59;
}
}
double magic = floor(stats.mana); //Returns number of full bars
yheart += 2;
xheart = 59;
setcolor(15);
gotoxy(xheart, yheart);
printf("Enerza: %.2f/%.2f", stats.mana, stats.maxmana);
yheart++;
xheart = 59;
setcolor(14);
while(magic > 0)
{
gotoxy(xheart, yheart); //Prints out full bars
putchar(219);
xheart++;
magic--;
if(xheart == 79)
{
yheart++;
xheart = 59;
}
}
magic = fmod((stats.mana * 2), 2); //Returns 0-2, depending on how much of bar is left
gotoxy(59, 15);
if(magic > 0 && magic <= 1)
{ //If 1/4th of heart
gotoxy(xheart, yheart);
setcolor(30);
putchar(221);
xheart++;
if(xheart == 79)
{
yheart++;
xheart = 59;
}
}
if(magic > 1 && magic <= 2)
{
gotoxy(xheart, yheart);
setcolor(14);
putchar(219);
xheart++;
if(xheart == 79)
{
yheart++;
xheart = 59;
}
}
magic = floor(stats.maxmana - stats.mana);
while(magic >= .5)
{
gotoxy(xheart, yheart);
setcolor(1);
putchar(219);
magic--;
xheart++;
if(xheart == 79)
{
yheart++;
xheart = 59;
}
}
if(magic > 0)
{
gotoxy(xheart, yheart);
setcolor(1);
putchar(221);
magic = 0;
xheart++;
if(xheart == 79)
{
yheart++;
xheart = 59;
}
}
setcolor(15);
gotoxy(59, 7);
printf("%s", stats.weaponu);
gotoxy(70, 7);
printf("%s", stats.weapono);
gotoxy(59, 9);
printf("%s", stats.weaponj);
gotoxy(70, 9);
printf("%s", stats.weaponl);
gotoxy(59, 16);
setcolor(15);
printf("Dunars: ");
setcolor(14);
printf("%.0i", stats.money);
gotoxy(70, 16);
setcolor(12);
putchar(232);
gotoxy(61, 18);
setcolor(15);
printf("%s", levelname);
gotoxy(58, 0);
}
void updatebattlestats(monstats curmon)
{
}
void loadlevel() //Loads a map into the matrix, the map is not outputted to the screen, it is simply loaded, use printgrid to output to screen.
{
if(level == 1.0)
{
strcpy(matrix[0]," _________________________________________________________ ");
strcpy(matrix[1],"| |");
strcpy(matrix[2],"| |");
strcpy(matrix[3],"| |");
strcpy(matrix[4],"| |");
strcpy(matrix[5],"| |");
strcpy(matrix[6],"| |");
strcpy(matrix[7],"| |");
strcpy(matrix[8],"| |");
strcpy(matrix[9],"| |");
strcpy(matrix[10],"| |"); //Tutorial level where you begin, here the player is taught
strcpy(matrix[11],"| ----- ---- |"); //how to do the basics of the game.
strcpy(matrix[12],"| | | |");
strcpy(matrix[13],"| | | |");
strcpy(matrix[14],"| | | |");
strcpy(matrix[15],"| | | |");
strcpy(matrix[16],"| ------------ |");
strcpy(matrix[17],"| |");
strcpy(matrix[18],"| |");
strcpy(matrix[19],"|_________________________________________________________|");
strcpy(levelname, "Training Quarters");
}
if(level == 50)
{
strcpy(matrix[0]," _________________________________________________________ ");
strcpy(matrix[1],"| |");
strcpy(matrix[2],"| |");
strcpy(matrix[3],"| |");
strcpy(matrix[4],"| |");
strcpy(matrix[5],"| __________________________________________ |");
strcpy(matrix[6],"| | | |");
strcpy(matrix[7],"| | | |");
strcpy(matrix[8],"| | | |");
strcpy(matrix[9],"| | | |"); //Battle Arena for fighting monsters
strcpy(matrix[10],"| | | |");
strcpy(matrix[11],"| | | |");
strcpy(matrix[12],"| | | |");
strcpy(matrix[13],"| | | |");
strcpy(matrix[14],"| |__________________________________________| |");
strcpy(matrix[15],"| |");
strcpy(matrix
```