cocos2d中的坐标系统

BenOnceMore 2013-08-26

源网站:http://blog.csdn.net/allenice1/article/details/7727052

sprite的锚点设置

默认锚点:中心

jetSprite.setAnchorPoint(cc.p(0.5,0.5));

 锚点:left、bottom(左下角)

jetSprite.setAnchorPoint(cc.p(0,0));

 锚点:left、top(左上角)

jetSprite.setAnchorPoint(cc.p(0,1));

 锚点:right、bottom(右下角)

jetSprite.setAnchorPoint(cc.p(1,0));

 锚点:right、top(右上角)

jetSprite.setAnchorPoint(cc.p(1,1));

 我觉得用cc.p(x,x)这样设置锚点有点记不住这么设置,所有我一般将常用的锚点做成一个对象:

var Anchor = {};
Anchor.LEFT_TOP = cc.p(0,1);
Anchor.RIGHT_TOP = cc.p(1, 1);
Anchor.RIGHT_BOTTOM = cc.p(1, 0);
Anchor.LEFT_BOTTOM = cc.p(0, 0);
Anchor.MIDDLE = cc.p(0.5, 0.5);

相关推荐