updated 方法简化
This commit is contained in:
parent
f9fdc1832d
commit
3de27670eb
8
game.js
8
game.js
@ -245,9 +245,7 @@ function Game(id,params){
|
|||||||
var item = new Item(options);
|
var item = new Item(options);
|
||||||
//动态属性
|
//动态属性
|
||||||
if(item.location){
|
if(item.location){
|
||||||
var position = item.location.coord2position(item.coord.x,item.coord.y);
|
Object.assign(item,item.location.coord2position(item.coord.x,item.coord.y));
|
||||||
item.x = position.x;
|
|
||||||
item.y = position.y;
|
|
||||||
}
|
}
|
||||||
//关系绑定
|
//关系绑定
|
||||||
item._stage = this;
|
item._stage = this;
|
||||||
@ -261,9 +259,7 @@ function Game(id,params){
|
|||||||
this.items.forEach(function(item,index){
|
this.items.forEach(function(item,index){
|
||||||
Object.assign(item,item._settings,item._params);
|
Object.assign(item,item._settings,item._params);
|
||||||
if(item.location){
|
if(item.location){
|
||||||
var position = item.location.coord2position(item.coord.x,item.coord.y);
|
Object.assign(item,item.location.coord2position(item.coord.x,item.coord.y));
|
||||||
item.x = position.x;
|
|
||||||
item.y = position.y;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user