I am having a problem on the console game I am making. How can I decrease the health of the character or enemy with loopings? My code goes like this by the way for example:
class RPG_Scene_Battle {
public:
RPG_Scene_Battle(float ini_health) : health (ini_health){};
float getHealth()
{
return health;
}
void setHealth(float rpg_val){ health = rpg_val;};
private:
float health;
};
float conductDamage(RPG_Scene_Battle rpg_tr, float damage) {
rpg_tr.setHealth(rpg_tr.getHealth() - damage);
return rpg_tr.getHealth();
}
how can I do a do while loop to decrease the player and enemy's hp without returning the method? because returning the method conductDamage
under the do loop would return the same value and not decrease constantly.