import Phaser from "phaser"; import Scene from "./scene"; function launch({ containerId, onLose }) { const container = document.getElementById(containerId); const width = container.clientWidth; const height = container.clientHeight; const game = new Phaser.Game({ type: Phaser.CANVAS, width, height, parent: containerId, scale: { mode: Phaser.Scale.FIT, autoCenter: Phaser.Scale.CENTER_BOTH, parent: containerId, width: 2160, height: 2160, }, scene: Scene, }); Object.assign(game, { onLose, restart() { this.scene.scenes[0].scene.start("scene"); }, }); return game; } export default launch; export { launch };