In my current game (using spritesheets) all anchor points are set to 0,0. I need to however rotate a few sprites around their texture center (0.5, 0.5) while keeping the anchorpoint at 0,0. Is there a smart way of doing this?
Rotating a texture (not the sprite)
(3 posts) (2 voices)-
Posted 1 year ago #
-
Try rotating its parent. If the parent is a
CCSpriteSheet, then create an intermediate node between theCCSpriteSheetand theCCSpritethat you want to rotate.CCSpriteSheet < - grandparent
CCSprite <- parent . This is the intermediate node. Probably with a rect(0,0,0,0), so that it is invisible
CCSprite <- you. The sprite that you want to rotatePosted 1 year ago # -
Interesting idea... Thanks. In the end though I subclassed my objects though to set the anchorpoint to .5,.5 and changed setPosition to add half of the spritewidth to the position, now I can rotate as required without having to change my positioning code.
Posted 1 year ago #
Reply
You must log in to post.