Well its all a matter of design choice really. Adrenaline is a good
idea - remember in fighting games where you have to build up
a status bar by making powerful attatcks, and when you reach
a high enough level, you can pull of a special move?
Your classes are going to be of a similar form as the one I
posted earlier, so I'll just show you an implementation of one of
the functions in in it, whereby a player kicks another player.
here's the class again
Now an implementation of kickoponent:
bool kickoponent (Fighter &oponent);
bool punchoponent (Fighter &oponent);
int GetHealth ();
//and so on for more detailed attacks
I mentioned inheritance earlier, and it is a good application of it.
bool Fighter::kickoponent(Fighter &oponent)
if (oponent.health <= kickstrength)
oponent.health = 0;
return false //oponent is dead!
oponent.health -= kickstrength; //performing damage of amount kickstrength
adrenaline += 10; //increasing adrenaline by some amount
return true; //player still has some health, so let main know about it
What you would do would be to write a base class with some
very basic functionality, such as basic moves such as punches
and kicks, methods to return the health and so on. Then
you can create a whole bunch of classes which inherit all this
functionality and can implement extra things such as player
specific moves. Each class will inherit the same types of attributes
but can have different values for those attributes - one character
can have stronger kicks than another, but the code that executes
a kick is the same - you only write it once!
You should get started on implementing the above class - just
do one class type and test it out in a program that looks like the
pseudo-program I posted earlier.