0
我使用Phaser 2.6.2,我有一个背景图层和一个对象图层的地图,我想在游戏后动态添加图块到对象图层开始。到目前为止,我还没有找到任何答案,但是遇到了与putTile不同的其他问题。使用Phaser的tilemap.putTile与多个tilesets不起作用
我已经尝试过不同的方法来编写putTile命令并加载图层,但最终要么是错误,要么从我的其他tileset中放置一个图块,要么放置一个空白(白色)图块。下面的代码放置一个空白(白色)瓦片。
下面的代码:
//Add the JSON tilemap
this.map = this.game.add.tilemap('mk2064');
//Add the background tileset
this.backgroundtileset = this.map.addTilesetImage('backgroundTileset', 'gameTiles', 32, 32, 0, 0, 0);
//create the background layer
this.backgroundlayer = this.map.createLayer('backgroundLayer');
//add object tileset
this.objecttileset = this.map.addTilesetImage('objectTileset', 'objectTiles', 32, 32, 0, 0, 1);
//create the object layer
this.objectlayer = this.map.createBlankLayer('objectLayer', this.backgroundlayer.width, this.backgroundlayer.height, 32, 32);
//add a tile to the object layer
this.map.putTile(this.objecttileset[0], 5, 5, this.objectlayer);
任何帮助,将不胜感激.....谢谢!