Javascript Phaser 3类型脚本错误游戏不绑定
到目前为止,我已经尝试过使用Typescript绑定简单地启动Phaser3游戏。下面是我的main.js入口点Javascript Phaser 3类型脚本错误游戏不绑定,javascript,phaser-framework,Javascript,Phaser Framework,到目前为止,我已经尝试过使用Typescript绑定简单地启动Phaser3游戏。下面是我的main.js入口点 /**@type {import("../typings/phaser")} */ let config = { type: Phaser.AUTO, width: 800, height: 600 }; let game = Phaser.Game(config); 我正在使用我认为是phaser.d.ts中最新的类型脚本定义。然而,当我加载游戏时,我得到
/**@type {import("../typings/phaser")} */
let config = {
type: Phaser.AUTO,
width: 800,
height: 600
};
let game = Phaser.Game(config);
我正在使用我认为是phaser.d.ts中最新的类型脚本定义。然而,当我加载游戏时,我得到以下错误
phaser.min.js:1 Uncaught TypeError: Cannot read property 'bind' of undefined
at Object.initialize [as Game] (phaser.min.js:1)
at Object.parcelRequire.src/main.js (main.js:7)
at newRequire (main.1e43358e.js:49)
at main.1e43358e.js:81
at main.1e43358e.js:107
Phaser.Game
是一个构造函数函数,需要使用关键字new
:
let game = new Phaser.Game(config);
啊!非常感谢你!