节点对象 位置定位
可以直接是node.x , node.y
也可以是node.position.x , node.position.y
但前提是,具体以哪个为参考呢,是父级,那又是怎样与怎样的一个定位为,是锚点anchor
当父级的锚点是在中心点,及anchor 的x = 0.5,y = 0.5;
子节点的锚点也是在中心点石,那,设置子节点的位置 x=0,y=0就刚好在父节点的中心点。
那这样2d的花,在中心点右、上为正,左下为负
比如,你想把子节点放在父级的左下角为
this.node.x = (-this.node.parent.width/2 + this.node.width/2); this.node.y = (-this.node.parent.height/2 + this.node.height/2);
