【发布时间】:2019-01-15 22:29:10
【问题描述】:
当我到达应该触发我正在开发的游戏中的第二关的区域时,我在切换场景时遇到了问题。由于某些原因,游戏没有显示第二关,而是显示黑屏并且控制台上没有错误。我认为我的问题的答案在这里 (http://www.html5gamedevs.com/topic/37617-trouble-changing-scenes-in-phaser-3/),因为提出问题的人遇到了我的问题并设法解决了它,但我不明白他的上一篇文章。
我在第一个场景中调用第二个场景的方式是函数:
PassaggioLivello() {
if(this.player.sprite.x > 15400){
this.scene.start(MainScene2);
}
}
两个场景都包含在配置文件中:
import {MainScene} from "./main-scene.js";
import {MainScene2} from "./main-scene.js";
let config = {
type: Phaser.AUTO,
width: 1280,
height: 720,
backgroundColor: "#000c1f",
parent: "game-container",
scene: [MainScene, MainScene2],
pixelArt: true,
physics: { default: "matter" },
plugins: {
scene: [
{
plugin: PhaserMatterCollisionPlugin, // The plugin class
key: "matterCollision", // Where to store in Scene.Systems, e.g.
scene.sys.matterCollision
mapping: "matterCollision" // Where to store in the Scene, e.g. scene.matterCollision
}
]
}
};
let game = new Phaser.Game(config);
你能帮帮我吗?我不明白我的错误。
【问题讨论】:
标签: javascript syntax-error screen phaser-framework