テンプレートを使って作成するとmain.jsは以下のようになっている。
import { Game as MainGame } from './scenes/Game';
import { AUTO, Scale,Game } from 'phaser';
// Find out more information about the Game Config at:
// https://newdocs.phaser.io/docs/3.70.0/Phaser.Types.Core.GameConfig
const config = {
type: AUTO,
width: 1024,
height: 768,
parent: 'game-container',
backgroundColor: '#028af8',
scale: {
mode: Scale.FIT,
autoCenter: Scale.CENTER_BOTH
},
scene: [
MainGame
]
};
export default new Game(config);
import { AUTO, Scale,Game } from 'phaser'; を記載しない場合は、
AUTO、Scale、Gameに Phaser. をつける。
import { Game as MainGame } from './scenes/Game';
//import { AUTO, Scale, Game } from 'phaser';
// Find out more information about the Game Config at:
// https://newdocs.phaser.io/docs/3.70.0/Phaser.Types.Core.GameConfig
const config = {
type: Phaser.AUTO,
width: 1024,
height: 768,
parent: 'game-container',
backgroundColor: '#028af8',
scale: {
mode: Phaser.Scale.FIT,
autoCenter: Phaser.Scale.CENTER_BOTH
},
scene: [
MainGame
]
};
export default new Phaser.Game(config);