ok guys and gals here's my delema, i have this code:
all it basically does is define two classes, one that defines the stuff for the player and his actions, the other for the enemies (or monsters)
the problem is that i have funtions in both that require i include the other, because i am programming in c++ i understand that code only goes in a linear direction, down....... so when the compiler tries to compile is says that "character is not defined" because it hasn'e been defined yet but is being passed as an argument in monster...........is there any way that i can do this??? i can't think of anything myself ...............................
(sorry word wrap on makes sloppy looking code it doesn't really go on to the next line like that...........
class monster{
public:
monster(){}
void initiate_enemy(int level,lvl_type ctype, int player_x, int player_y,char [50][50]);
~monster(void);
void get_pos(int & xpos, int & ypos);
void truepos(int & xpos, int & ypos);
bool move(char [50][50]);
void take_damage(int dam, int pierc);
void cast_spell();
void melee_attack(character player);
void get_stats(int & health, int & mana, int & dam, int & defence, int & pierc);
void show_stats();
bool passable(char map[50][50],direction direction);
direction facing;
bool dead;
private:
//basic character stats
string name;
lvl_type type;
int hp;
int max_hp;
int lvl;
int mp;
int max_mp;
int gp;
int damage;
int def;
int pierce;
//basic elements the stats are composed of
int agility;
int health_points;
int str;
int intelect;
//for the direction facing, the position, and the map itself
int x_pos;
int y_pos;
int x;
int y;
int movedup,moveddown,movedright,movedleft;
bool possible_move;
//needed for enemies
bool possible_attack;
};
class character{
public:
character(){}
void initiate_player();
~character(void);
void get_pos(int & xpos, int & ypos);
void truepos(int & xpos, int & ypos);
bool move(direction direction,char [50][50]);
void take_damage(int dam, int pierc);
void cast_spell();
void melee_attack(monster enemy[50]);
void get_stats(int & health, int & mana, int & dam, int & defence, int & pierc);
void show_stats();
void add_page(pages type);
bool passable(char map[50][50],direction direction);
direction facing;
bool dead;
private:
//basic character stats
string name;
lvl_type type;
int hp;
int max_hp;
int lvl;
int mp;
int max_mp;
int gp;
int damage;
int def;
int pierce;
//basic elements the stats are composed of
int agility;
int health_points;
int str;
int intelect;
//to keep track of the items
int redpotions;
int bluepotions;
int pages_earth;
int pages_fire;
int pages_wind;
int pages_ice;
//for the direction facing, the position, and the map itself
int x_pos;
int y_pos;
int x;
int y;
int movedup,moveddown,movedright,movedleft;
bool possible_move;
//needed for enemies
bool possible_attack;
};