3
votes

I'm making a CCSprite rotating animation with cocosbuilder2.1, cocos2d 2.0. It works great on iPhone4S(iOS 8.0.2), iPhone5 Simulator, iPad 2 Simulator, iPad Retina Simulator, but has "jittering" problem on iPhone5S(iOS 7.1.1), iPhone5S Simulator, iPad Air Simulator, iPhone 6 Simulator, iPhone 6 Plus Simulator. The build setting is as follows:

In Build Settings under Targets:

Base SDK = Latest iOS (iOS 8.0); Valid Architectures = arm64 armv7 armv7s

In General under Targets:

Deployment Target = 6.0

At first I thought it's a bug in cocosbuilder, but after testing by manually making a sprite rotating and having the same problem, I feel there's something wrong in cocos2d 2.0's compatibility with iPhone5S.

code: in the layer of the first scene

-(void)onEnter {
    [super onEnter];
    ...//play music
    ...//load image resources
    CCSprite *testSprite = [CCSprite spriteWithSpriteFrameName:@"testIMG.png"];
    testSprite.position = ccp(200,200);
    [self addChild:testSprite];
    CCRotateBy *rotateAction = [CCRotateBy actionWithDuration:3 angle:360];
    [testSprite runAction:rotateAction];
    ...//other stuff, nothing related with CCBReader or cocosbuilder
}

The "jittering" problem is as if the rotation value of the testSprite has been set to 0 everyFrame ater it's been set to the right value. e.g. It's like it rotates to 1, then back to 0, then to 2, then back to 0, 3, 0, 4, 0 ... etc. And all these happens very quickly, which makes it kind of "blinking". At last the rotation is always reset to 0.

I tried google it, but found nothing related, as if this is a very personal problem. If it's a personal issue, please let me know which direction I should working towards to find where the bug is, thanks!

1

1 Answers

14
votes

Though still now sure what causes this problem, I solved it by changing the Valid Architectures to armv7. This build settings will not take advantages of new architectures on devices newer than iPhone4S, but at least won't cause the jittering issue.

==============Update=================

I found a warning that's related with this problem. “multiple methods named 'setRotation' ” See related problem: ARC semantic issue "multiple methods named 'setRotation' " while archiving only

Though I've upgraded cocos2d to v2.2 version for my old project (too complex to update to v3), I still got the warning.

Finally I used type casting to solve it as following in CCBAnimationManager.m

@implementation CCBRotateTo
-(void)startWithTarget:(CCNode *)aTarget
{
    [super startWithTarget:aTarget];
    starAngle_ = [(CCNode *)self.target rotation];
    diffAngle_ = dstAngle_ - startAngle_;
}

-(void)update:(ccTime)t
{
    [(CCNode *)self.target setRotation: startAngle_ + diffAngle_ * t];
}

With this change, now I can support arm64 too.