1
\$\begingroup\$

BOOL = GREENIE, UIButton =GREEN. When I click the GREEN button, I coded that now you play as GREENIE character. However, I don't know how to code it that the game always remember that the I clicked on GREEN button a few games ago. The way I currently have it is when you click on GREEN button, you play the game as GREEN character then when you lose and go back to beginning of start, you play as original character instead of GREEN. So I want to make it that the game saves the choice of GREEN character instead of having to manually pick him before each game.

I tried using NSUserDefaults standardUserDefaults but it's not working.

[[NSUserDefaults standardUserDefaults]setBool:YES forKey:@"save"];
GREENIE=[[NSUserDefaults standardUserDefaults]boolForKey:@"save"];

How do I makes GREENIE=YES saved as as character I picked instead of having to pick GREENIE manually every time before game starts?

(EDIT: NSUserDefaults StandardUserDefaults works for when saving integerForKey though but not boolForKey. Maybe I coded it wrong?)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.