Can you give me the ideas of managing the sprites? Or the approach that you use for your project.
I’m going to create a new project. I used to type the file name add the init method. I know that if the project’s getting bigger, it’s going to get ugly and difficult to maintain, so I want to know the idea of it.
if you mean keeping track of your Sprite objects on screen, or what has been created, etc then I use an std::vector and toss the them in after creation.
I usually create a LoadingScene which it’s init method load everythings to cache Sprite -> SpriteFrameCache, or Audio -> SimpleAudioEngine, they are Singleton classes so I can access everytime, everywhere, very useful
What I meant to ask was managing the sprite file name.
Let’s say if I use the sprite sheet. Is it better if I create the header file to store all the file name into const char[] or const string of each file name? So when I create sprite, I can choose from these variables instead of typing the file name in init method
I use a plist file to describe all the objects in my games.
So this includes the sprite name and other related information
So my ‘start level’ method, reads the appropriate plist and creates the objects based on the entries there.