Cocos2d: is it good practice to use a shared GameScene when having various levels?
- by mm24
In my code (based on the ShootEmUp example in this book, which I highly reccomend, source code in chapter 8 available here) I often use the trick of accessing the GameScene via:
+(GameScene*) sharedGameScene;
which returns a reference to the static instance of GameScene. Is a static instance of GameScene as in the book still a valid pattern in case I want a MainMenu calling GameScene initialized with different level data each time (e.g. different enemies)? (I have created a sceneWithId:(int) method where I load different level data each time.
Or should I pheraps create a GameScene class and then sublcass it?
E.g. FirstGameScene : GameScene