-
Game
I'm making a text-based adventure game in which you can buy things, travel to cities, being attacked by bandits with random skill/lvl depending on your lvl. But how can I combine the skills strength, intelligence, agility and the total exp/lvl to make a kind of "damage" variable which can be used in battle? Do you guys have any ideas?
-
Rather then a single damage variable each should affect certain things individually, as well as be a damage variable. Like intelligence increases the max (critical) damage you can do, agility decreases the chance of a hit being landed on you, and strength increases hp.
As for the variable you could do it something like this
Damage_Factor = 1.0 + Strength * 0.04 + Intelligence * 0.06 + Agility * 0.08
-
Remeber to use a class for the player and enemy. Use a constructor to implement and action the variables, General idea I used for my Flymo game:
Code:
class Player
{
public:
Player( Hp = 100, Mp = 0, Expi = 1, Score = 0 );
private:
int m_hp;
int m_mp;
int m_expi;
string m_name;
long m_score;
};
Player::Player (Hp, Mp, Expi, Score);
{
hp = Hp;
mp = Mp;
expi = Expi;
score = Score;
}
Just an idea, you do not have to use this example, but I found it effective in the game
I made. There may be some errors in the code above but you get the general idea
-
I haven't learnt classes yet, I use structs instead. It works fine for me.