Managing Multiple scenes

Hello friends i am developing my game using cocos2dx. i have started cocos2dx a month back. I dont have a very good hand on c*+ as before i was developing games for J2ME phones. But somehow i have managed with c**.
Currently i am facing some problems in managing the UI. As my game will have different screens . So i need to know that do i have to create separate ‘Scene’ for each screen or do i have to follow any other approach.
Is there a way that we can create a ‘SceneManager’ class, but as i hav told that i am not very good at c*+, i am confused about where to start.
Plz give me some solution for my problem…

Suveer Jacob wrote:

Hello friends i am developing my game using cocos2dx. i have started cocos2dx a month back. I dont have a very good hand on c*+ as before i was developing games for J2ME phones. But somehow i have managed with c**.
>
Currently i am facing some problems in managing the UI. As my game will have different screens . So i need to know that do i have to create separate ‘Scene’ for each screen or do i have to follow any other approach.
Is there a way that we can create a ‘SceneManager’ class, but as i hav told that i am not very good at c*+, i am confused about where to start.
Plz give me some solution for my problem…

Hi Jacob, I’m not quite that experienced yet, but I guess I’d share what I’ve seen so far: I’ve been looking at the JavaScript examples (the API is the same so the proggramming patterns should still apply) and they all (even the more complex ones like moonwarrior) just use layers, not scenes, but given the names of the classes, your approach should make more sense… I mean, it sound more coherent to have a scene for each “state” of the game (menu, in-game, etc) and split each of those in propper layers, but IDK… Have you checked the docs?

Thanx a lot for your reply Sebastian…. i know many games uses multiple layers and just one scene and they replace one layer with another layer…. But as i told that i am not that good in C++ i m unable to understand the approach for how can i do that. It would be better if i can get an example code(an easy one) for it… I have also seen TestCpp class but it is way too difficult to understand…

Suveer Jacob wrote:

Thanx a lot for your reply Sebastian…. i know many games uses multiple layers and just one scene and they replace one layer with another layer…. But as i told that i am not that good in C*+ i m unable to understand the approach for how can i do that. It would be better if i can get an example code for it… I have also seen TestCpp class but it is way too difficult to understand…
I see… I’ve made a few searches here on the forums, but they all point out to TestCpp as the best source of information…
Have you checked the following pages?
http://cocos2d-x.org/projects/cocos2d-x/wiki/Director_Scene_Layer_and_Sprite
http://cocos2d-x.org/projects/cocos2d-x/wiki/Cocos2D-X
http://www.cocos2d-x.org/reference/native-cpp/V2.1.4/index.html

If you aren’t that good with C*+ that you can’t even properly understand the samples (I’m not trying to be rude, I’m good with C but I suck on cpp) I would advise you to:

a. switch to another language (you can also develop using cocos2d using Javascript, C# and… LUA I think? If you use JavaScript you can first develop your game with the cocos2d-html5 framework and run it on a web browser, then compile it as native application for android and ios. If you don’t know JS but feel like giving it a try (it’s way simpler than cpp) I reccomend you head over to codecademy.com and go thru the free JS course)
b. learn a solid base of c++, then come back to cocos (there are several good places to start learning cpp, I’d reccomend checking out the forums and tutorials over at gamedev.net)
c. there are several frameworks for game development that don’t require you to write a single line of code, they are not free ’tho.

Hey Thanx a lot sebastian… i think your second option is suitable…… i need to brush up my c++ skills……

At your service. BTW, the first link I gave you is particularly ontopic on the how to properly use scenes with the director, layers and sprites issue. It even has some minimal code examples! :smiley:

And if you go up one level on that hierarchy of articles you’ll find all the introductions to the basic topics of the engine, they are all very reccomendable!