I have 2 question belongs to structuring the game scene , layer. In my game I used separate scene for Menu and Game. Menu scene hold many layers like main menu scene have a connection to settings layer & levels layer.
MENU SCENE (stack of multiple layers main Layer , Levels Layer , Settings Layer)
1. Main Layer
- play Button
- Levels Button -> Load Level Layer
- Settings Button -> Load Settings Layer
- Help
2. Levels Layer
- Level 1 Button -
- Level 2 Button | -> Replace the MENU SCENE with GAME SCENE
- Level N Button -
3. Settings Layer
GAME SCENE (Stack of Game la开发者_如何转开发yer & status menu layers sits on the top)
1. Game Layer
2. Status Menu layer
- Score Label
- Reset Level Button
- Main Menu Button
How to use common background image for both Menu scene and game scene?
Please validate the above structuring is it good enough in scalability preceptive?
A good aproach, would be using 2 Layes on your scenes, a BackGroundLayer and a GamePlayLayer, then u could use the same BackGroundlayer on each of your scenes. Or use just one scene and BackGroundLayer and just switch the Gameplay Scenes.
You can create use a Delegate calling a method in the Main Menu file. I would encorage you to create an GameManager Class, that would handle that
I notice your structure is a bit wrong, a good one would be:
Main Scene Main Layer - play Menu Button - Levels Menu -> Level (Player shall choose level?) (store an id to identify witch level will be used - Settings -> Settings Menu (Change ur settings?) - Help Menu
When the player chooses a level it will store in a Constant witch level the player will be playing and when he hits the play button u just load one scene for all levels, and just change the GamePlay Layer.
There is a really great book that explore a hole chapter talking about GameManager, Menus and stuff. i Really encorage you to buy it.
http://cocos2dbook.com/ - (Learning Cocos2D: A Hands-On Guide to Building iPhone and iPad Games with Cocos2D, Box2D, and Chipmunk)
It will be finished in July i guess, but u can buy the rougth cut... i did, its really good pdf always updates http://my.safaribooksonline.com/book/programming/iphone/9780132180863
Again, a really good book. i read it.
精彩评论