Basic game architechture best practices in Cocos2D on iOS
Posted
by
MrDatabase
on Game Development
See other posts from Game Development
or by MrDatabase
Published on 2012-04-13T21:07:19Z
Indexed on
2012/04/13
23:45 UTC
Read the original article
Hit count: 291
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.
© Game Development or respective owner