Game Development Reference
In-Depth Information
Achievement trackers
In this part of the chapter, we will add trackers for each of our achievements. Each
tracker will have its own function. The functions will be very similar to each other, but
will have their own variables to affect.
When the functions are called, it'll take in an integer; this integer is the amount of the
stat that we want to check. Within the function, we check with our bool variables to
see whether that achievement can still be gained. Next, we check the amount in order
to iterate the achievement level appropriately.
Once the achievement level is at its highest amount, we disable the ability to gain
more achievements for that skill.
Tracking the kills
Our first tracker will track the player kills; let's add the tracker function now:
void Kills(int Amount)
{
if(getKills)
{
if(Amount >= 10 && Amount < 49)
{
if(achKills != 1)
achKills++;
}
if(Amount >= 50 && Amount < 99)
{
if(achKills != 2)
achKills++;
}
if(Amount >= 100 && Amount < 249)
{
if(achKills != 3)
achKills++;
}
Search WWH ::




Custom Search