I am designing a game in objective C where a player earns money by answering correctly some questions. I am trying to display a congratulation message only once when he reaches a threshold ( every $1000 for example ). I know I can use flags like in the code below:
if (money>threshold){
if (congratMsgShown==NO){
[self displayCongratMsg];
congratMsgShown=YES;
}
}
The problem with this is that it works only with one threshold. As my player can earn up to $1M, I would have to use 1000 flags like the congratMsgShown. Is there a method in Objective C to call a function only once when a threshold has been reached?
Cheers
What about using the same method and changing the threshold?