Thursday, 28 June 2012

How to get a Sprite by tag in Cocos2D ?


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.

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

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


No comments:

Post a Comment