0

I have a project with 2 Scenes.

In my second Scene, i have a button. This button when clicked create at runtime a CCNode from a SPriteBuilder Resources. This CCNode called "Strategy", has 5 custom CCNode created in SpriteBuilder in the Strategy Node.

When I add a simple CCNode in this Strategy CCNode and try to run an Action, nothing happened, meanwhile in another SCene all is working fine and also in second Scene but not in Strategy CCNode context.

Why this???

EDIT:

- (void)didLoadFromCCB
{
    //Load Strategy
    strategy = (Strategy*) [CCBReader load:@"LevelScene/Strategy"];

    [strategy setContentSizeType:CCSizeTypeMake(CCSizeUnitNormalized, CCSizeUnitNormalized)];
    [strategy setContentSize:CGSizeMake(1.0, 1.0)];

    //Add as a child
    [self addChild:strategy];

    //WORK - TEST
    [self runAction:[CCActionRotateBy actionWithDuration:1.0 angle:360]];

    //NOT WORK - TEST
    [strategy runAction:[CCActionRotateBy actionWithDuration:1.0 angle:360]];

    Crystal *crystal = (Crystal*) [CCBReader load:@"Resources/Crystal"];
    [strategy addChild:crystal];
    //... set crystal position ...//

   //NOT WORK - TEST
    [crystal runAction:[CCActionRotateBy actionWithDuration:1.0 angle:360]];
}
Allen Walker
  • 866
  • 1
  • 9
  • 17
  • The second scene is the current scene on screen? The objects that you are trying to run an action are added as child of this screen? Actions only run for objects that are are added as child – Bivis Sep 16 '14 at 02:35
  • Yes, i push the second Scene on the first Scene and is the current Scene displayed. When i press a button I add Strategy as a child of the Second Scene and then after load the Node, I called another method that add a random number of objects Node, added as child of Strategy. These nodes doesn't animate with runAction... – Allen Walker Sep 16 '14 at 07:44
  • You need to post the code in question. – CodeSmile Sep 16 '14 at 08:25
  • Edit the post with some code – Allen Walker Sep 16 '14 at 08:30

0 Answers0