Search code examples
cocos2d-iphonerotationtexture2d

how to rotate Texture2D in cocos2d-iphone


I'm making a game using cocos2d-iphone, I want's to rotate a Texture2D of maybe 20 degrees, what can I do?

I tried glRotate(20.0f, 0.0f, 0.0f, 1.0f), but it doesn't work.

So any ideas?


Solution

  • Use the CCSprite property rotation

    CCSprite* sprite = [CCSprite spriteWithTexture:texture];
    sprite.position = ccp(100,100);
    sprite.rotation = 20;
    [scene addChild:sprite];