Currently I am working with cocos2d for the iPhone. I want to make my game structured and consequential. How to manage all the game components?
What do I mean with game components? A game component is e.g. the terrain or any other object like a character that is drawn on the scene. These components have attributes and duties like "let's clean up that place" or something similar.
So actually I want to wrap a component with all its attributes to make the code reusable. E.g. think of terrain. There may be a terrain in the front. Behind this terrain there is another terrain, e.g. hills, it's still terrain but just with maybe another color.
How do I accomplish that in cocos2d? In my scene there is a draw method where I normally would draw the terrain. But if I would put everything that is drawn in that method it would get confusing.
It would be cool to create an object of a terrain class and add this to the scene which would draw the terrain automatically. How do I do that? What would be the parent class of the terrain class?