combining multiple CCSprites into one grouped object in cocos2d

后端 未结 1 346
陌清茗
陌清茗 2020-12-18 05:37

I wonder what\'s the best approach to combine several CCSprites dynamically into one grouped object using cocos2d.

I have to dynamically create characters from a set

相关标签:
1条回答
  • 2020-12-18 06:09

    Create an empty CCSprite and add the body parts from different sprites. Example:

    CCSprite *body = [CCSprite node];
    CCSprite *arm = [CCSprite spriteWithSpriteFrameName:@"arm.png"];
    [arm setPosition:CGPointMake(10,10)];
    
    [body addChild:arm];
    

    And so on. This way you can rotate the sprite named body and all body parts will adjust accordingly.

    0 讨论(0)
提交回复
热议问题