ccnode

CCNode recursive getChildByTag

烂漫一生 提交于 2019-12-24 10:34:36
问题 As far as I understand the CCNode::getChildByTag method only searches among direct children. But is there any way to recursively find a CCNode's child by tag in all its descendant hierarchy ? I'm loading a CCNode from a CocosBuilder ccb file and I'd like to retrieve subnodes knowing only their tags (not their position/level in the hierarchy) 回答1: One way - to create your own method. Or create category for CCNode with this method. It will look like smth like this - (CCNode*)

Cocos2d - Change CCNode Image Programmatically

浪子不回头ぞ 提交于 2019-12-08 02:59:39
问题 Does anyone know how to change a CCNode's image programmatically? I'm using SpriteBuilder to make a simple game. 回答1: A CCNode does not have an image. Only CCSprites have images. You can change the image of a CCSprite using the spriteFrame property. 回答2: Assuming you are using a CCNode object in your scene, you'll need to create a method in the object's implementation file an call it out when you want to change the image. In the Scene code: CustomObject *blahblah; [blahblah ChangeNodeImage:

Moving a Stick figure, anchorpoints, animation, or something else…?

亡梦爱人 提交于 2019-11-27 01:30:00
Ok so I am making a game with stick figures with cocos2d in objective c... Different things need to be animated so please, give me a suggestion of what would be the best way to go about accomplishing the movement for these things: The main character- he is an archer in the bottom left corner who does not move around, except he will move his upper body because you need to change the angle of where you are shooting the angle... The enemies- hordes of stick figures coming at you that have collision detection and die when shot by an arrow sprite. How should I make 1 and 2 move? should I master

Moving a Stick figure, anchorpoints, animation, or something else…?

眉间皱痕 提交于 2019-11-26 09:40:05
问题 Ok so I am making a game with stick figures with cocos2d in objective c... Different things need to be animated so please, give me a suggestion of what would be the best way to go about accomplishing the movement for these things: The main character- he is an archer in the bottom left corner who does not move around, except he will move his upper body because you need to change the angle of where you are shooting the angle... The enemies- hordes of stick figures coming at you that have