Hello Guys,
I am Playing around with CCSprite And animations i found an issue with the following code.
CCChar.h
class CCChar:public cocos2d::CCSprite
{
CCCharType type;
public
static CCChar* CCCharWithSpriteFrameName(const char pszSpriteFrameName);
};
h1. CCChar.cpp
CCFish CCFish::CharWithSpriteFrameName(const char pszSpriteFrameName)
{
CCFish c_fish = new CCFish();
CCSpriteFrame **pFrame = CCSpriteFrameCache::sharedSpriteFrameCache~~>spriteFrameByName;
c_fish~~>createWithSpriteFrame;
c_fish~~>autorelease;
return c_fish;
}
h1. From CCLayer Class
CCSpriteFrameCache::sharedSpriteFrameCache~~>addSpriteFramesWithFile;
CCSpriteFrameCache::sharedSpriteFrameCache~~>addSpriteFramesWithFile;
CCSpriteFrameCache::sharedSpriteFrameCache~~>addSpriteFramesWithFile;
charsheet= CCSpriteBatchNode::create;
addChild;
char2sheet= CCSpriteBatchNode::create;
addChild;
char3sheet= CCSpriteBatchNode::create;
addChild;
int type =rand3+1;
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCArray* animFrames = CCArray::createWithCapacity(10);
for(int k = 2; k < 10; k++)
{
CCString *str_frame=CCString::createWithFormat(“fish0d_0%d.png”,type,k);
animFrames~~>addObject~~>spriteFrameByName));
str_frame~~>release;
}
char1act=CCRepeatForever::create));
CCChar _char= CCFishfish=CCChar::CharWithSpriteFrameName-
_char~~>runAction;
*char~~>setTag;
_char~~>setScale;
*char~~>setPosition);
charsheet~~>addChild;
with above code i Stuck at following line while executing**charsheet->addChild(_char,3);*
// check CCSprite is using the same texture id
CCAssert~~>getName == m_pobTextureAtlas~~>getTexture->getName, “CCSprite is not using the same texture id”);
Thanks,
Nikhil