#172299 - Azenris - Fri Jan 29, 2010 4:36 pm
I wanted to create an achievement system and wondering whats a good way to go
about it. I was thinking of something like
and then within the event system whenever an event is called
loop the medals passing the event as an arguement.
Also I was thinking of having a seperate list of actively watched medals, only those would be called.
For example have a medal type MEDAL_TYPE_OUTOFBATTLE, all those types of medals would be
loaded when out of battle and the rest ignored. This would also allow me to not bother calling
already completed medals.
I dunno does this sound OK, what other possibilies could I explore for an achievement system?
_________________
My Homebrew Games
about it. I was thinking of something like
Code: |
class CMedal
{ // func: Virtual Update(const CEvent &event) = 0; // var: name // var: description } |
Code: |
class CMedal_1 : public CMedal
{ CMedal_1 () : CMedal("Shopoholic", "Visit the shop 5 times") { } // func: Update(const CEvent &event) // check for 5 entires into the shop // vars: any specific counters to this medal // eg: count events EVNT_ENTERED_SHOP } |
Code: |
class CMedal_2 : public CMedal
{ CMedal_2 () : CMedal("Bruised", "Take a total of 1000 damage in a game") { } // func: Update(const CEvent &event) // check for 1000 damage total taken // check for end of game (EVNT_GAME_FINISHED), clear damage var // vars: any specific counters to this medal // eg: count damage taken } |
Code: |
void Init_Medals(void)
{ medalList.push_back(new CMedal_1); medalList.push_back(new CMedal_2); } |
and then within the event system whenever an event is called
loop the medals passing the event as an arguement.
Also I was thinking of having a seperate list of actively watched medals, only those would be called.
For example have a medal type MEDAL_TYPE_OUTOFBATTLE, all those types of medals would be
loaded when out of battle and the rest ignored. This would also allow me to not bother calling
already completed medals.
I dunno does this sound OK, what other possibilies could I explore for an achievement system?
_________________
My Homebrew Games