UNPKG

cocos2d-html5

Version:
20 lines (17 loc) 757 B
var IgnoreAnchorpointTest1 = cc.Layer.extend({ ctor : function(){ this._super(); var winSize = cc.Director.getInstance().getWinSize(); var layer1 = cc.LayerColor.create(cc.c4b(255, 100, 100, 128), winSize.width / 2, winSize.height / 2); layer1.ignoreAnchorPointForPosition(true); var layer2 = cc.LayerColor.create(cc.c4b(100, 255, 100, 128), winSize.width / 4, winSize.height / 4); layer2.ignoreAnchorPointForPosition(true); layer1.addChild(layer2); layer1.setPosition(winSize.width / 2, winSize.height / 2); this.addChild(layer1); } }); IgnoreAnchorpointTest1.create = function(args){ var layer = new IgnoreAnchorpointTest1(); return layer.init() ? layer : null; };