Text based game Help

I am making a small text based game and need a little help on two problems I can not figure out.

Problems:
A timer of some type so every 3 seconds it will increase a number by one(Health regeneration)

A way to make a damage absorbing bubble. I can write the code of one but I can not get it to subtract from the "shield."

x = shield
y = health
z = damage done

I do not know how to subtract from the health after the shield hits zero:

x = 25
y = 25
z = 50

I can make it take the x to negative but not subtract from the health until the next hit.

Any ideas?

P.S I'm more of a beginner so long and basic is better then short and advanced.

A way to make a damage absorbing bubble. I can write the code of one but I can not get it to subtract from the "shield."
1
2
3
4
5
int attack = 5, health = 20, shield = 2; 
if(attack > shield)
{
    health = health - (attack - shield); 
}


Problems:
A timer of some type so every 3 seconds it will increase a number by one(Health regeneration)


This is quite a major task to accomplish and I certainly would not recommend it to a beginner.
Duh..... I never thought to use ()'s lol. Thank you :)

And will do I'll have to come up with something else then.
Topic archived. No new replies allowed.