I have a problem. Someone has been helping me on my game. No matter how many times they work on it and come back, it seems to get worse. Originally, the game would add +20 (out of 100) to health. It didn’t do above 100, just stayed full. Now when I play, it give 40, then 80…,100,120,140 etc. Basically, it adds 20 AND the current health, and goes above the max health, adding length to the health bar. I definitely don’t want this, I’d like to add some sort of, health cannot be greater than 100 or Max health must equal 100. I will show you the code, as I can tell I’m looking dead at some part of the problem, but since I can’t code, I can’t fix it myself. Please help if you can, or ask for more info if you need.
public void GiveHealth(int healthToGive)
{
Health = Health + healthToGive;
//Health = maxHealth;
GameManager.Instance.ShowFloatingText ("+" + Health, transform.position, Color.red);
}
I’ve tried changing the world health to 0 + healthgiven (which is, I believe, 20) , and even delete health + altogether, to no change.