refine TiledTile (#2977)

This commit is contained in:
yinkaile
2018-07-13 16:26:19 +08:00
committed by pandamicro
parent d2468971af
commit 0ba932be11
2 changed files with 9 additions and 4 deletions
+4 -2
View File
@@ -333,8 +333,10 @@ let TiledLayer = cc.Class({
if (!tile && forceCreate) {
let node = new cc.Node();
tile = node.addComponent(cc.TiledTile);
tile.x = x;
tile.y = y;
tile._x = x;
tile._y = y;
tile._layer = this;
tile._updateInfo();
node.parent = this.node;
return tile;
}
+5 -2
View File
@@ -129,8 +129,11 @@ let TiledTile = cc.Class({
this._updateInfo();
}
else if (this._layer) {
if (this._layer.getTiledTileAt(this._x, this._y)) {
cc.warn('There is already a TiledTile at [%s, %s]', x, y);
let tile = this._layer.getTiledTileAt(this._x, this._y);
if (tile) {
if (tile !== this) {
cc.warn('There is already a TiledTile at [%s, %s]', x, y);
}
}
else {
this._layer.setTiledTileAt(this._x, this._y, this);