From 3de27670eb2b2f1abc9f31bdb5c3779e4ed764d8 Mon Sep 17 00:00:00 2001 From: mumuy Date: Wed, 17 Jan 2018 14:53:26 +0800 Subject: [PATCH] =?UTF-8?q?updated=20=E6=96=B9=E6=B3=95=E7=AE=80=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/game.js b/game.js index 7331c0b..64e433c 100644 --- a/game.js +++ b/game.js @@ -245,9 +245,7 @@ function Game(id,params){ var item = new Item(options); //动态属性 if(item.location){ - var position = item.location.coord2position(item.coord.x,item.coord.y); - item.x = position.x; - item.y = position.y; + Object.assign(item,item.location.coord2position(item.coord.x,item.coord.y)); } //关系绑定 item._stage = this; @@ -261,9 +259,7 @@ function Game(id,params){ this.items.forEach(function(item,index){ Object.assign(item,item._settings,item._params); if(item.location){ - var position = item.location.coord2position(item.coord.x,item.coord.y); - item.x = position.x; - item.y = position.y; + Object.assign(item,item.location.coord2position(item.coord.x,item.coord.y)); } }); };