How do games handle level selection screens where you have to swipe left and right to select the level? Such games seem to have different sprites for each level (e.g. Amazing Alex).
How is it possible to have so many sprites loaded up without taking too much space in memory? Are they loaded in memory all at once? Is there a special technique used in such cases? In my game level select, I have 20 levels each with it’s own sprite (icon). How is it possible to handle all these sprites all at once?
Bear in mind that a maximum of 3 sprites appear on screen at once as the user scrolls left and right to select the level.
Any examples or links would be useful.
In the game SmashTurtle that I created, I used the UIScrollView scrolling code from the tutorial at http://ios.biomsoft.com/2011/11/28/a-paging-uiscrollview-in-cocos2d-with-previews/
SmashTurtle has 25 200×200 point nodes that can be selected with multiple sprites added to each and I was able to achieve ok performance on 3gs devices and good performance on newer devices.
I load all of the sprites when the select level scene is presented. No memory warnings and it loads quite quickly. I load one 1024×1024 sheet that has 25 sprites on it. I also load 25 separate sprites from files as well; bad for load time and draw call performance, but still works ok given it is just a level select scene with nothing else going on.
The reason for loading the 25 sprites from separate files was that I needed the sprites in separate files for some levels that only required one of the 25 spites and did not want to duplicate the 25 separate sprites into a sprite sheet which would increase the bundle size.
Without that strange constraint of loading 25 separate files in the select level scene, I could have made the level select scroller more performant. But even with loading the sprite sheet plus 25 separate files the performance was acceptable on a 3gs.