Search code examples
cocos2d-iphonekobold2d

Where to register NSUserDefaults in kobold2d


I am trying to track when my app is first run on a device so it will play a short video and then from there after make the video skippable.So I am doing this with NSUserDefaults, but I am using Kobold2d and that uses lua to set things up. I am wondering where I should register the NSUserDfaults. As far as I understand this is usually done in the app delegate but it looks like it is overridden in kobold2d. Any help would be appreciated!


Solution

  • The Kobold2D AppDelegate has the initializationComplete method that is run just before the first scene is loaded. You can add such init code there. Or simply add it in the init method of your first scene. It really only depends on where you first start making use of NSUserDefaults variables, but very likely not before the first scene's init method is run.