Commit 9ad2908b authored by zjz1994's avatar zjz1994

食物关卡兼容

parent 96e59e0f
......@@ -1185,27 +1185,29 @@ export default class MainScene extends Scene {
//食物
initFoods(){
var foodsdata = this.chapterData.map.foodsdata;
for(var i=0;i<foodsdata.length;i++){
var ifood = foodsdata[i];
var ifoodtype = ifood.type;
var ifoodidx = ifood.luidx;
var ifoodir = ifood.dir;
var ifood1:Food = Pool.takeOut(RecoverName.FOOD);
if(!ifood1){
ifood1 = new Food();
if(foodsdata){
for(var i=0;i<foodsdata.length;i++){
var ifood = foodsdata[i];
var ifoodtype = ifood.type;
var ifoodidx = ifood.luidx;
var ifoodir = ifood.dir;
var ifood1:Food = Pool.takeOut(RecoverName.FOOD);
if(!ifood1){
ifood1 = new Food();
}
var ipos = ifood1.resetFood(ifoodtype,ifoodir,ifoodidx);
ifood1.x = ipos[0];
ifood1.y = ipos[1];
this.mapupfoodContainer.addChild(ifood1);
var ifoodname = 'food_'+i;
ifood1.name = ifoodname;
this.icefoodArr.push({
name:ifoodname,
inidxs:JSON.parse(JSON.stringify(ifood1.lockidxs))
});
// console.log("食物处理",ifoodtype);
}
var ipos = ifood1.resetFood(ifoodtype,ifoodir,ifoodidx);
ifood1.x = ipos[0];
ifood1.y = ipos[1];
this.mapupfoodContainer.addChild(ifood1);
var ifoodname = 'food_'+i;
ifood1.name = ifoodname;
this.icefoodArr.push({
name:ifoodname,
inidxs:JSON.parse(JSON.stringify(ifood1.lockidxs))
});
// console.log("食物处理",ifoodtype);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment