cocos2d中的坐标系统
源网站: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);
相关推荐
Cricket 2020-05-31
woxmh 2019-12-30
CaptainCTR 2019-12-19
86463960 2013-07-15
80487916 2013-07-06
86463960 2013-08-28
89741733 2014-03-20
86201242 2014-05-13
85427010 2014-09-04
文艺小青年 2015-03-26
cooclc 2015-03-26
85427010 2015-05-22
frankwang 2015-05-19
80487916 2015-05-18
进入场景而且过渡动画结束时候触发。提示 GameScene场景中的继承于节点,这些生命周期事件根本上是从Node继承而来。事实上所有Node对象都有这些事件,具体实现代码与GameScene场景类似。
87921036 2015-05-12
85427010 2011-12-31
yizhiyanstart 2011-12-31
oQiXiLaoTou 2012-09-25