开发者

CCRotateTo ISSUE - Xcode 4.0.2 && cocos2d-iphone-1.0.0-rc3

When I pass in the angle parameter 360 it doesn't execute, but if I pass in 180 it will only execute once...I have done this many times before in older versions of cocos2d. It is either I am completely missing something obvious in the code, or something with the unstable build version. Any help is appreciated.

    CC开发者_JAVA技巧Sprite *sun = [CCSprite spriteWithFile:@"Sun.png"];
    sun.position = ccp(470,310);
    [self addChild:sun z:1];

    id rotateSun = [CCRotateTo actionWithDuration:5.0 angle:360];

    [sun runAction:[CCRepeatForever actionWithAction:rotateSun]];


Try this:

id rotateSun = [CCSequence actions:
                  [CCRotateTo actionWithDuration:2.5f angle:180],
                  [CCRotateTo actionWithDuration:2.5f angle:360],
                  nil];

[sun runAction:[CCRepeatForever actionWithAction:rotateSun]];


or just use

CCRotateBy

because obviously your sprite would already have the rotation set to 360 by default...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜