ios - Access CCB root node animation timeline - Cocos2D -
this driving me insane. trying access ccb root node can animation timeline using spritebuilder/cocos2d.
i have herocharacter.m custom class of animation ccnode.
i importing bedroomscene.m. using
ccnode *_herocontainer; and in view did load
//import hero scene ccnode *hero = [ccbreader loadasscene:@"heros/panda"]; [_herocontainer addchild:hero]; when run animationmanager null value.
ccbanimationmanager* animationmanager = _herocontainer.userobject; nslog(@"am: %@", animationmanager); any suggestions?
first of all, when add together ccb kid of node should utilize load: not loadasscene:
ccnode *hero = [ccbreader load:@"heros/panda"]; [_herocontainer addchild:hero]; with above code hero root node of heros/panda ccb file.
with code using loadasscene root node wrapped in ccscene object , hence hero points ccscene instance, not ccb's root node. ccscene's children array contains 1 kid node actual ccb root node.
next you're adding loaded ccb kid of _herocontainer. animation manager given ccb on ccb's root node, means (if used load: not loadasscene:) animation manager in hero object, can't in _herocontainer node:
ccbanimationmanager* animationmanager = hero.userobject; nslog(@"am: %@", animationmanager); note if upgrade v3.1 of cocos2d can utilize hero.animationmanager access ccbanimationmanager.
ios cocos2d-iphone spritebuilder
No comments:
Post a Comment