私はマルチゲームのプロジェクトを持っています。私はmenu.js
と多くのゲームjsページを持っています。Phaser.js |状態を変更する前にタイルマップを削除する
menu.js
ロードページでは、表示が正しいです。 game.js
をロードしてmenu.js
に戻った後の画面は同じではありません。私は多くのソリューションを試しましたが、何も動いていません。私は最初と同じ様子を見せたいと思います。 menu.js
var menuState = {
create: function(){
game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
game.scale.setGameSize(1000, 600);
game.scale.minWidth = 300;
game.scale.minHeight = 180;
game.scale.maxWidth = 1000;
game.scale.maxHeight = 600;
game.scale.pageAlignHorizontally = true;
game.scale.pageAlignVertically = true;
game.scale.updateLayout(true);
game.state.start("game");
},
start: function(){
}
}
Menu.js
をロードする前に
Menu.js
this.map = game.add.tilemap('level2');
this.map.addTilesetImage('secondMap');
this.map.setCollisionByExclusion([13, 14, 15, 16, 46, 47, 48, 49, 50, 51]);
this.map.setTileIndexCallback(225, this.test3, this);
this.map.setTileIndexCallback(228, this.test, this);
this.map.setTileIndexCallback(231, this.test2, this);
this.layer = this.map.createLayer('Tile Layer 1');
this.layer.resizeWorld();
私は外観が正しいthis.layer.resizeWorld();
を削除し、自宅に戻った場合、また、私はそれが悪いリターン登場map
だと思います。
私が試してみました:
this.layer.destroy();
this.map.destroy();
game.world.removeAll()
game.state.clearCurrentState();
が、常に同じ結果を。
私が使用している場合:
game.state.destroy();
game.destroy();
がすべて削除されます。
どこが問題かわかりません。
ありがとうございます。私の場合も完璧です! –