Hi guys!
I hope this post isn't that confusing, but I have a problem that is making my brain hurt. I am not good at programming haha! So my problem is this and I am very sorry if it just sounds like confusion:
I started a project using the Cocos template.
My project has a Session class and a Game class. The Session class contains a couple of variables that must exist throughout the life of my program.
Game = a single hand of blackjack
Session = 5 hands of a blackjack (i.e. 5 Games)
So, what I want to do ideally is that when the game starts, a new Session instance is created, which tracks how much money the player has left (let's call this session.moneyLeft)
Then I start an instance of Game which is a Cocos scene, and when that Game is done, the session.moneyLeft variable is updated, and then a new Game begins which checks out the session.moneyLeft variable to set it's game conditions.
So my problem is that I just can't figure out how to get this going, my program is like this right now:
BlackJackAppDelegate : applicationDidFinishLaunching
--> this method sets up a sharedDirector and calls runWithScene:Game
Game : +(id) scene
-(void) init These methods set up a blackjack table and play out a hand of blackjack
This is all fine, but I can't figure out how to get the Game instances to read the Session.moneyLeft variables - I would just move all the stuff in BlackJackAppDelegate : applicationDidFinishLaunching to the Session class, but when I do that it doesn't work.
I guess what I am asking is, how could I move the SharedDirector and runScene somewhere other than the AppDelegate, can I? Or is that totally idiotic?
(By the way, that is why this is a Cocos2d question, not just an objective C question)
Argh, is this super obvious and I'm just tired and whatever? Thoughts?