I have a question about creating custom init methods in my Player class that inherits from CCNode. Not sure if I need to instead take a different route and create class methods instead:
+ (id) addSprite: (CCSprite*) sprite andSpriteBatchNode: (CCSpriteBatchNode*) spriteBatch;
more class methods ....
In Player
class, I have a designated init method, along a few convenience init methods.
- (id) init;
- (id) initWithSpriteBatchNode: (CCSpriteBatchNode*) spriteBatch;
- (id) initWithSprite: (CCSprite*) sprite andSpriteBatchNode: (CCSpriteBatchNode*) spriteBatch;
//designated init method
When I instantiate this class in my Level class I am not able to call any of my custom init methods directly. What I have to do is:
Player *player = [Player node];
[player initWithSprite: sprite andSpriteBatchNode: spriteBatch;];
//not sure if this is even correct or will it leak memory
I think either should work since they are doing the same thing just on at instance level, the other methods at name.
Please advise.