【问题标题】:Phaser 3. Importing phaser/src/core/Game produce error during runtimePhaser 3. 导入 phaser/src/core/Game 在运行时产生错误
【发布时间】:2021-10-14 01:29:34
【问题描述】:

移相器游戏未启动错误

import Game1 from "phaser/src/core/Game";
import { Game } from "phaser";
console.log(Game1, Game);
const app = new Game1(gameSettings);

控制台日志的以下输出是类似的类:

但是当我尝试直接使用phaser js中的那个时,没有发现错误

import { Game } from "phaser";
const app = new Game(gameSettings);

提前感谢您回答我做错了什么。

【问题讨论】:

    标签: html5-canvas phaser-framework


    【解决方案1】:

    在我在网上找到的所有示例中,我都看到了 Phaser 的这种导入

    import 'phaser';
    import Phaser from 'phaser';
    import * as Phaser from 'phaser';
    

    然后用

    启动游戏
    new Phaser.Game(config)
    

    【讨论】:

      猜你喜欢
      • 2022-08-13
      • 2018-08-04
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-07
      • 2021-12-14
      相关资源
      最近更新 更多