Cocos2D: Problem Rotating a CCMenu

Posted by srikanth rongali on Stack Overflow See other posts from Stack Overflow or by srikanth rongali
Published on 2010-03-20T12:51:11Z Indexed on 2010/03/20 13:31 UTC
Read the original article Hit count: 473

Filed under:
|
|

If I try to do actions over menuItems but the actions are not running as expected.

I think code below should make the menuItem rotate by 90 degrees but when I run it, the menuItem translates from its coordinates to another coordinate then returns to its original coordinate. The complete translation takes 3 seconds.

What I need is for the menuItem to rotate by 90 degrees in place within a 3 seconds duration. Please explain where I have done wrong?

CCMenuItemImage *targetE;//Globally declared
CCMenu *menu;//Globally declared

-(id)init
{
    if( (self = [super init]) )
    {
        isTouchEnabled = YES;
        CGSize windowSize = [[CCDirector sharedDirector] winSize];
        targetE = [CCMenuItemImage itemFromNormalImage:@"grossinis_sister1.png"     selectedImage:@"grossinis_sister1.png" target:self selector:@selector(touch:)];

        menu = [CCMenu menuWithItems:targetE,nil];
        id action4 = [CCRotateBy actionWithDuration:3.0 angle:90];
        [menu runAction: [CCSequence actions: action4, nil]];
        menu.position = ccp(windowSize.width/2 + 200, windowSize.height/2); 
        [self addChild: menu z:10];
    }
    return self;
}
@end

Thank You.

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about cocos2d