Hi guys. I want to make a very simple rpg game, which gives me the choice to attack or use a weapon against two objects (rock and log) that have lives, but one at a time. When I use my weapon, I can equip one out of the five that I have. After which, I attack and the object loses it's life (strength) slowly ( though the object does not attack, it's like a training dummy). I need to make classes for my name, MP (mana points), HP (Health Points), and make functions for the damage inflicted, special skill (which removes 10 HP) and mana skill (which removes 10 MP). :) So far, if you compile this code, you get the output:
class character
{
private:
int m_hp;
int m_mp;
string m_sName;
int m_strength;
public:
character(); // default constructor
character (string sName, int strength, int mp, int hp);
int getHP();
void setHP(int newHP);
int getMP();
void setMP(int newMP);
int getStrength();
void setStrength(int newStrength);
string getName();
void setName(string newName);
};
then you can create character like this;
1 2 3
character rock("rock", 50, 0,0);
character log("log", 30, 0,0);
character player("fred", 50, 20,20);
you can then start adding functions to modify the characters properties;
1 2 3 4
character::damage(int damage)
{
m_hp -= damage;
}
and use them like this;
rock.damage(10);
that should get you started, there's nothing better than a good text based rpg :)