import Phaser from "phaser"; import flipbird from "./scenes/flipbird/flipbird"; 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, physics: { default: "arcade", arcade: { //gravity: { y: 300 }, debug: false, }, }, scene: flipbird, scale: { mode: Phaser.Scale.FIT, autoCenter: Phaser.Scale.CENTER_BOTH, parent: containerId, width: 1080, height: 1080, }, }); Object.assign(game, { onLose, restart() { this.scene.scenes[0].scene.start("flipbird"); }, }); return game; } export default launch; export { launch };