开发者

CCsprite anchor point problem

I have some problem with Anchor point..

i have a sprite and i need to calculate the anchor point for this sprite around the screen center.

H开发者_JAVA技巧ow can i calculate the anchor point?


You can access the anchor point values using:

mySprite.anchorPoint.x 

and

mySprite.anchorPoint.y

These are both floating point values so be aware of that.

EDIT

To set them you just do:

mySprite.anchorPoint = ccp(1.0f, 1.0f);

An anchor point of (1.0, 1.0) would be the upper right corner of your image, whereas the original anchor point is in the middle and therefore, (0.5, 0.5). To try and solidify the anchor point for the bottom left would be (0.0, 0.0). You can get any other anchor point within the image by understanding these.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜