So, I am trying to merge two classes, a Bullet Class and a BulletCache class from one program into a single class of another.
The Bullet Class is a subclass of CCSprite, and the BulletCache class is a subclass of CCNode.
I’m trying to create a Bullet Class that is a subclass of Item, which is a subclass of LevelObject, which is a subclass of CCNode. So you can see how it ties together.
My new Bullet class (as declared in the Items class file) has these instance variables, the upper two are from the Bullet Class, while the bottom two are from the BulletCache.
{
CGPoint velocity;
bool isPlayerBullet;
CCSpriteBatchNode* batch;
int nextInactiveBullet;
}
The CCSpriteBatchNode* is not recognized by Xcode in this project, despite all my efforts. At the top of the file I wrote
@class CCNode;
Yet the CCSpriteBatchNode is still undefined. Any help and advice is much appreciated.
Question in a nutshell: How the hell does I get CCSpriteBatchNode (a common cocos2d class) to be defined in this project?
The other issue is that the @interface Item : LevelObject and @interface Bullet : Item are written on the same file. I tried the @class CCSpriteBatchNode; and no success.
I also tried "#import CCSpriteBatchNode.h" and still no success.
Xcode seems insistent that CCSpriteBatchNode class does not exist
Assuming I follow you correctly, I’d think your class layout would look something like this (note, I’ve separated mine into separate files; if you use the same files, in general, the declaration in your file should follow the same order from top to bottom):
LevelObject.h:Item.h:Bullet.h:Bullet.m: