Interacting with scene from controller/app delegate cocos2d

Posted by cjroebuck on Game Development See other posts from Game Development or by cjroebuck
Published on 2011-02-15T20:48:46Z Indexed on 2011/02/17 15:34 UTC
Read the original article Hit count: 301

Filed under:
|

I'm attempting to make my first cocos2d (for iphone) multiplayer game and having difficulty understanding how to interact with a scene once it is running.

The game is a simple turn-based one and so I have a GameController class which co-ordinates the rounds. I also have a GameScene class which is the actual scene that is displayed during a round of the game. The basic interaction I need is for the GameController to be able to pass messages to the GameScene class.. such as StartRound/StopRound etc.

The thing that complicates this is that I am loading the GameScene with a LoadingScene class which simply initialises the scene and replaces the current scene with this one, so there is no reference from GameController to GameScene, so passing messages is quite tricky.

Does anyone have any ways to get around this, ideally I would still like to use a Loading class as it smooths out the memory hit when replacing scenes.

© Game Development or respective owner

Related posts about cocos2d-iphone

Related posts about cocos2d