I want to create a battle system for an RPG game, one a little more robust then the previous one I made. This one I want to be very dynamic and easy to use. I want to use the Allegro API for it, but first I want to make sure I have everything going good in console before I put it into a real time rpg, but I'm having technical difficulties...
Now here are my classes...
class Game{
};
class Boxer:Game{
public:
char name[256];
int health, *attack, level, critchance,xp,requiredxp;
int Attack(){return -(*attack-rand()%(level/2));}
void setName(){}
void AdjustXP(int x){xp+=x;}
void Spash(){printf("HP:%d\tXP:%d/%d\n",health,xp,requiredxp);}
void EveryFrame(){*attack=level*3;}
Boxer(){health=25;level=15;requiredxp=level*5,xp=0;}
};
class Battle:Game{
public:
void Attack(int attackerhit, int * attackeehp){*attackeehp+=attackerhit;}
};
int main(){
srand(time(NULL));
Boxer Boxer;
Battle Battle;
int attack=5;
Battle.Attack(attack,Boxer->hp) //??? Heres my problem I believe
cout<<Boxer.hp;
}
Right now I want to pass the Boxer class' HP through a pointer to the Battle Classes Attack function, while passing a normal int (since the attack really doesnt need to be adjusted as of now). I get really weird errors like no matching function for call to `Battle::Battle(int&, int)'|... Please help!!!