I have subclassed NSCoding
and added my game specific stuff to it such as health etc. I have serialised the object I have subclassed however upon decoding and then adding the sprite to the screen via [self addChild:sprite]
, it fails to draw the sprite to the screen.
I am guessing this is because CCSprite
needs to also implement the NSCoding
protocol so my questions are:
1) Am I right about my assumption above (I don't want to waste time implementing this solution to only find out this is not the issue)
2) What is the best way to get CCSprite
to implement NSCoding
? Is it to use Categories or just subclass it and force the subclass to implement the NSCoding
protocol?
LOL sorry it was late at night when i wrote that, i figured out the solution by early morning. The problem i had was i was sending a subclass of CSSprite from one process to another, i was confused as to why the sprite was not being displayed in the receiving process. I figured out not all of the sprite data was being serialised. The solution i implemented was to only send across information i needed such as coordinates,image name etc and just rebuild the sprite from scratch on the receiving end :)