0
我正在使用Visual Studio,Phaser和Typescript開發我的第一款遊戲。Typescript擴展關鍵字不工作
我不能讓我的班工作時,我使用extends關鍵字
這工作:
class Game {
game: Phaser.Game;
constructor() {
// init game
this.game = new Phaser.Game(window.innerWidth * window.devicePixelRatio - 20, window.innerHeight * window.devicePixelRatio - 20, Phaser.CANVAS, 'content', State);
}
}
這不:
class Game extends Phaser.Game{
constructor() {
// init game
super(window.innerWidth * window.devicePixelRatio - 20, window.innerHeight * window.devicePixelRatio - 20, Phaser.CANVAS, 'content', State);
}
}
我一直在努力整天都沒有成功地弄清楚這一點,任何人都可以點亮它嗎?
「不起作用」是什麼意思?你遇到了什麼錯誤? –
當我使用extends關鍵字運行遊戲時,我得到一個空白屏幕,引發的錯誤是:Uncaught ReferenceError:移相器未定義 – Johntk