iCodeXcode
iCodeXcode

Reputation: 329

SpriteKit - method similar to getChildByName/getChildByTag in Cocos2d

Now started porting game from Cocos2d to Sprite-Kit as Cocos2d not offers box2d physics and new version of Cocos2d 3.0 has less features.

Got struct with some place while porting it to Sprite-Kit. Is there any way to get child node from parent in SpriteKit ?

    (CCSprite *)[self getChildByTag:2022]; //cocos2d syntax

How can I achieve this in Sprite-Kit ?

Upvotes: 0

Views: 381

Answers (1)

AndrewShmig
AndrewShmig

Reputation: 4923

See Apple documentation on SKNode:

– childNodeWithName:

– enumerateChildNodesWithName:usingBlock:

Also see SKNode's userData property.

Upvotes: 2

Related Questions