cocos JS for循环让精灵从屏幕中间往两边排列散开

//this.ShowImg[i] 需要排列什么就push加进数组里面,一个for循环计算即可

var size = this.ShowImg.length;
var count = size;
for(var i=0;i<size; i++)
{
count--;
var a =count;
this.ShowImg[i].setVisible(true);
this.ShowImg[i].setPositionX(800 + 80*(a-1)-(i*80));
  //800为屏幕(父节点)X轴的中点,80为距离的宽度
}
原文地址:https://www.cnblogs.com/luorende/p/6715132.html