var mainBg = cc.Layer.extend({
sprites :
{'leadingRole' : ''}
],
init : function(){
//this.setAnchorPoint(cc.p(1,1));
//this.setPosition(cc.p(100,100));
//this.setColor(255,255,0,0);
var yellowBackground = cc.LayerColor.create(cc.c4b(255,255,0,255),100,100);
//var spriteA = new cc.Sprite.create('resources/alarm.png');
//spriteA.setPosition(cc.p(50,50));
yellowBackground.setAnchorPoint(cc.p(0,0)); //这里无论是1,1还是0,0,黄色框框的位置还是不变
yellowBackground.setPosition(cc.p(10,10));
this.addChild(yellowBackground,0);
}
});
我就画一个黄色的框框,但设置锚点为1,1还是0,0貌似效果都一样,坐等大神。