John Vasiliou
John Vasiliou

Reputation: 997

Slow down rotation speed in cocos2d

I have my sprite rotating, but a little too fast, here is my code, any idea how to control the speed of the rotation?

//enemySprite
    enemySprite = [CCSprite spriteWithFile:@"Asteroid.png"];
    enemySprite.anchorPoint = ccp(0.5f, 0.5f);
    enemySprite.position = ccp(arc4random()%480, winSize.height -60);

//Rotation
    id rotate = [CCRotateBy actionWithDuration:1 angle:360];
    id repeatRotate = [CCRepeatForever actionWithAction:rotate];
    [enemySprite runAction:repeatRotate];

    [self addChild:enemySprite z:5];
    [self schedule:@selector(callEveryFrame:)];

Upvotes: 0

Views: 402

Answers (1)

sergio
sergio

Reputation: 69027

You can try to make it slower by increasing its duration:

id rotate = [CCRotateBy actionWithDuration:X angle:360];

where you can use, e.g., 5.0 for X. This will make it 5 times slower as it currently is.

Upvotes: 1

Related Questions