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.

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

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 *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.