Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对锚点有一些问题..
我有一个精灵,我需要围绕屏幕中心计算这个精灵的锚点。
如何计算锚点?
您可以使用以下方法访问锚点值:
mySprite.anchorPoint.x
和
mySprite.anchorPoint.y
这些都是浮点值,所以要注意这一点。
编辑
要设置它们,您只需执行以下操作:
mySprite.anchorPoint = ccp(1.0f, 1.0f);
(1.0, 1.0) 的锚点将是图像的右上角,而原始锚点位于中间,因此 (0.5, 0.5)。尝试巩固左下角的锚点将是 (0.0, 0.0)。通过了解这些,您可以获得图像中的任何其他锚点。