Main.ts


import { Game } from 'phaser';
import rexvirtualjoystickplugin from 'phaser3-rex-plugins/plugins/virtualjoystick-plugin.js';
import MainScene from './scenes/MainScene';
const config = {
  type: Phaser.AUTO,
  width: 950,
  height: 550,
  backgroundColor: '#cccccc',
  parent: 'app',
  scale: {
   mode: Phaser.Scale.FIT,
   autoCenter: Phaser.Scale.CENTER_BOTH
 },
 physics: {
  default: 'arcade',
  arcade: {
    gravity: { x: 0, y: 300 },
    debug: false,
   }
 },
plugins: {
  scene: [{
   key: 'rexVirtualJoystick',
   plugin: rexvirtualjoystickplugin,
   mapping: 'rexVirtualJoystick',
     start: true
   }]
},
  scene: [MainScene] 
};
window.addEventListener('DOMContentLoaded', () => {
    //  new Phaser.Game(config);
  new Game(config);
});