I have a quiz type of game. One question and 4 possible answers. The answers are dynamically pulled from JSON file from web services. I have 1 question displayed as CCLabelTTF and 4 answers (a, b, c and d) also as CCLabelTTF. Now, I need to show an alert for confirming the answers whichever the user has selected/tapped. - First question: How can I detect the answers a, b, c and d? I mean which answer the user has touched? - Second, How can I assigned a unique property to each of these answers? I mean I want to do like this:
CCLabelTTF *answerA = [CCLabelTTF labelWithString:@"This will be dynamically set" fontName:@"verdana" fontSize:25];
answerA.tag = @"Here goes the unique Identifier for answerA"; /* Is it okay with tag or is there some more good process? I am thinking to do answerA.tag = 0; 0 for incorrect and 1 for correct answers. */
This tag identifier will be used to compare the correct answer and the selected answer like this:
When the user tap "YES" in Alert, the following comparison will occur:
if(answerA.tag == @["movies"][i]@["answer"][i]@["status"]) // @["movies"][i]@["answer"][i]@["status"] will either have 0 or 1.
Is there another great solutions for this game? Like what if buttons used instead of text label? Please help.