How to get a Sprite by tag in Cocos2D ?

By | May 19, 2011


Sometimes you may need to get a sprite using tag while doing a project using Cocos2D. It’s easy to get a sprite by a tag in Cocos2D, use the following code to get it.

[c]tempSprite = (CCSprite*)[self getChildByTag:7];[/c]

Here ‘tempSprite’ is your CCSprite and it will get the sprite with tag 7.


Leave a Reply

Your email address will not be published. Required fields are marked *