开发者

sprite position

I'm anew cocos2d developer and I have a tiny problem and i need your help..

Actually i need to rotate a Sprite around the screen center,开发者_C百科 i put the position to the screen center and the anchor point to (-1,-2) for example and i did the rotate.

NOW my problem that i need to know the real position for the sprite after the rotation , every time i tried to read the position i got the screen center point and that's what i do not need.

Is there a way Or method to get the real position for Sprite??


Let the centre point be(x1,y1) and the sprite is at (x2,y2), then distance between them is http://www.purplemath.com/modules/xyplane/dist07b.gif


The sprite's position IS it's anchor point. Wherever the sprite's anchor point is on the screen, that is it's position. Normally this is the center of the sprite, but if you change the sprite's anchor point then it won't be the center. I'm not quite certain on the math but I expect you would add the difference (from sprite center to it's new anchor point) to it's rotation.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜