Basic game architechture best practices in Cocos2D on iOS
- by MrDatabase
Consider the following simple game: 20 squares floating around an iPhone's screen. Tapping a square causes that square to disappear.
What's the "best practices" way to set this up in Cocos2D?
Here's my plan so far:
One Objective-c GameState singleton class (maintains list of active squares)
One CCScene (since there's no menus etc)
One CCLayer (child node of the scene)
Many CCSprite nodes (one for each square, all child nodes of the layer)
Each sprite listens for a tap on itself. Receive tap = remove from GameState
Since I'm relatively new to Cocos2D I'd like some feedback on this design. For example I'm unsure of the GameState singleton. Perhaps it's unnecessary.