updated 部分代码优化
This commit is contained in:
parent
431f7eb155
commit
c1d10d44e4
10
index.js
10
index.js
@ -353,17 +353,11 @@
|
|||||||
speed:1,
|
speed:1,
|
||||||
update:function(){
|
update:function(){
|
||||||
if(!this.coord.offset){
|
if(!this.coord.offset){
|
||||||
var new_map = [];
|
var new_map = JSON.parse(JSON.stringify(map.data));
|
||||||
for(var j=0;j<map.data.length;j++){
|
|
||||||
new_map[j]=[];
|
|
||||||
for(var k=0;k<map.data[0].length;k++){
|
|
||||||
new_map[j][k]=map.data[j][k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var items = stage.getItemsByType(2);
|
var items = stage.getItemsByType(2);
|
||||||
var index = this.index;
|
var index = this.index;
|
||||||
items.forEach(function(item){
|
items.forEach(function(item){
|
||||||
if(item.coord.y&&item.index!=index){
|
if(item.index!=index){
|
||||||
new_map[item.coord.y][item.coord.x]=1;
|
new_map[item.coord.y][item.coord.x]=1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user