mm2*_*m24 0 math sprite cocos2d-iphone ios
如何找到CCSprite的中心点?
我的伪代码是:
A get sprite bounding box
B compute center point of the sprite
C move center point relative to sprite position and anchor point (this will be the center point of the sprite)
Run Code Online (Sandbox Code Playgroud)
而我的伪分辨率到目前为止是这样的:
A [sprite boundingbox] B 如何找到矩形的中心坐标? CI不知道:)
有什么建议吗?
精灵的中心点:
sprite.position;
Run Code Online (Sandbox Code Playgroud)
这假设anchorPoint处于默认状态,即0.5,0.5,强烈建议不要更改它,因为它可以让你完全处于这种状态.
不要更改精灵的anchorPoint,而是将精灵添加到CCNode对象作为子节点,并将精灵从CCNode中偏移.从那时起通过改变节点的位置属性来移动或重新定位精灵.