Reputation: 109
Sorry guys, this one is beating it. How can I tell if a CCSprite
has a given string value for it's spriteWithSpriteFrameName
?
Upvotes: 0
Views: 148
Reputation: 9079
I think the only choice you have is something like :
CCTexture2D *tex = [[CCTextureCache sharedTextureCache] textureForKey:@"image.png"];
if (tex && tex==sprite.texture) {
// do your thing ... make certain you understand the
// key semantics in cocos2d , re texture atlas
}
For myself, whenever getting a new 'cocos2d' version, i systematically add to CCNode a NSString *name property, which i use for various purposes, one of which is similar to what you are trying to do.
Upvotes: 1