Note that there are some explanatory texts on larger screens.

plurals
  1. POCCRepeatForever action stops automatically while switching scenes
    primarykey
    data
    text
    <p>I am developing a simple game app.</p> <p>I am required to have two screens one on left &amp; other on right, just like on scroll view with pagination having 2 screens to toggle between. I am detecting swipes with the help of RootViewController class and successfully swiping left and right screens. </p> <p>But the problem is I have to have infinitely running rotateBy action on both screens each running this action on single sprite placed on center of screen.</p> <p>I am using a main scene called SelectWorld &amp; two are it's sub scenes. First screen is called factory &amp; other is called stack. Following is my code:</p> <p>Select World Screen:</p> <pre><code>@implementation SelectWorld +(CCScene*)scene { CCScene* scene = [CCScene node]; SelectWorld* layer = [SelectWorld node]; [scene addChild:layer]; return scene; } -(id)init { if((self = [super init])) { [RootViewController singleton].swipeCallBackHandler = self; [[RootViewController singleton] enableSwipeDetection]; factory = [[ColorfulFactory scene] retain]; stack = [[CoinsStack scene] retain]; [self addChild:factory]; isOnFactory = YES; } return self; } -(void)swipedLeft { if(isOnFactory) { [self removeAllChildrenWithCleanup:YES]; isOnFactory = NO; CCTransitionScene* transitionalScene = [CCTransitionSlideInR transitionWithDuration:0.3 scene:stack]; [[CCDirector sharedDirector] replaceScene:transitionalScene]; } } -(void)swipedRight { if(!isOnFactory) { [self removeAllChildrenWithCleanup:YES]; isOnFactory = YES; CCTransitionScene* transitionalScene = [CCTransitionSlideInL transitionWithDuration:0.3 scene:factory]; [[CCDirector sharedDirector] replaceScene:transitionalScene]; } } </code></pre> <p>Here's the code for factory only, same goes for stack-</p> <pre><code>@implementation ColorfulFactory +(CCScene*)scene { CCScene* scene = [CCScene node]; ColorfulFactory* layer = [ColorfulFactory node]; [scene addChild:layer]; return scene; } -(id)init { if((self = [super init])) { CGSize size = [CCDirector sharedDirector].winSize; CCLabelTTF* info = [CCLabelTTF labelWithString:@"Colorful Factory" fontName:@"Helvetica" fontSize:35.0]; info.position = ccp(size.width/2, size.height-50); [self addChild:info]; CCSprite* sprite = [CCSprite spriteWithFile:@"Icon.png"]; sprite.position = ccp(size.width/2, size.height/2); [self addChild:sprite]; sprite.tag = 123; CCRotateBy* rotateBy = [CCRotateBy actionWithDuration:60 angle:360.0]; CCRepeatForever* repeatForever = [CCRepeatForever actionWithAction:rotateBy]; [sprite runAction:repeatForever]; repeatForever.tag = 456; } return self; } </code></pre> <p>Now the problem is, in first two swipes actions are running fine, but as soon as I try to swipe more than two or three times, actions got stopped. I haven't written a single line to stop this in both the classes. I require it there running forever.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload