Hello guys. I’m trying to find some source code or tutorials about scene with level selecting where when different level will load. Can anybody share them?
I store my levels in TileEd files, while have a name like “region_1.tmx”
In my application’s data, I have a list of names, one for each level.
The game logic selects the level (by number, in my case) and then gets the filename.
I end up with code the looks like this:
CCTMXTiledMap* _map = CCTMXTiledMap::create(this->getCurrentLevel()->filename());
There are different ways to do it, but my approach is to store each level, it’s behavior, objects and layout in a TMX file and then associate that file with a level ID. It also makes it easy to reuse levels.
Thanks a lot i’ll read about TiledMap. Mb you have some good game examples with level selecting to see how it works.
The simplest way (maybe not the most elegant) would be to have each level as a separate scene (or a level scene which would prepare it based on level number). On the selection screen you’d put a lot of buttons and assign each of them an unique tag (e.g. level number, or some kind of combination of chapter and level number) and each of these should have the same callback function, which would call some kind of level manager passing the tag and this manager would then decide what to load.