I have a GameWorld class which inherits CCLayer and returns a CCScene. My GameWorld has a synthesized property, "score." The score is incremented every 2 seconds - so the longer you play the game, the higher it goes.
Great!
Now I call my GameObject, which inherits CCNode and returns a sprite, to be added as a child to the layer. Every GameObject has a "cost" property.
But whenever you add a new sprite, your score goes down according to the cost.
So how can I set my (int) score in the GameWorld, FROM the GameObject, which contains the (int) cost that will decrement the score?
In other words, it's easy to set/get the GameWorld score from within the class, but my GameObject class can't see GameWorld. Is there a way to expose the setter method for a class's property to another class?
Thanks!