每点击一次减号按钮 deleteButton 把最上一节的竹子移除舞台同时把数组 bambooArr 中对应的竹子删除
var bambooArr = [];
var deleteButton = new PIXI.Sprite.fromImage("res/lianxi/ji/jsq7.png");
deleteButton.x = 330;
deleteButton.y = 330;
app.stage.addChild(deleteButton);
deleteButton.interactive = true;
deleteButton.on("click",remove);
//删除竹子图片
function remove(){
if(i != 0){
for(var a = i - 1; a < i ; a++ ){
var zhuzi = new PIXI.Sprite.fromImage("res/lianxi/zhuzi/zhuzi.png");
app.stage.addChild(zhuzi);
zhuzi.x = 200 ;
zhuzi.y = 300 ;
bambooArr.splice(a,1);
}
i--;
bambooArr[i].x = 200 - ( i * 89 );
bambooArr[i].y = 300 ;
}
//console.log("i:"+i+"数组:"+bambooArr.length);
}