Ok, before I start, yes I know the cause. The texture ids do not match. Thing is, I am under the impression that I’m doing the right thing, and this shouldn’t be happen.
In the directory, I have a set of png files:
accompanied by .plist files:
+These have been generated by TexturePacker. I’ve gone into the plist files, and for each of them, the metadata~~>textureFileName checks out:+
test1.plist~~>metadata~~>textureFileName = test1.png
test10.plist~~>metadata~~>textureFileName = test10.png
At the beginning of the game scene, I preload everything like so:
//I don’t have an itoa.
ss << i;
ss >> strNum;
std::string filepath = “test” + strNum “.png”;
std::string plistpath = “test” strNum +“.plist”;
CCSpriteBatchNode* spriteSheet = CCSpriteBatchNode::create);
//where allSpriteSheets is a CCArray* of SpriteBatchNode, so I can use it later.
//where baseLayer is a CCLayer* that is basically the first layer in the game scene.
later, I attempt to create a sprite using a frame already in the texture used in the CCSpriteBatchNode.
CCSprite* sp = new CCSprite;
//I’m purposely setting the frame I want to use here. Every plist file has the exact same naming convention, so it shouldn’t matter which one I use at this point.
std::string initName = “IDL001.png”
//The name is correct, and in fact this frame appears in all plist files, despite the animation length being different.
//the very first SpriteBatchNode I added to the base layer. This exists and is valid, because allSpriteSheets only contain SpriteSheets with the same animation naming convention.
CCSpriteBatchNode* targetLayer = allSpriteSheets~~>objectAtIndex;
//Omitted: setting sprite position
//this line triggers the Assert.
I did a CCLog before the Assert, and found that the texture ids are indeed different; this didn’t happen when I used a non-plist method.
Did I forget something here?
Thanks in advance.