main.ts 540 B

1234567891011121314151617181920212223242526272829303132
  1. window.addEventListener('load', function () {
  2. var game = new Phaser.Game({
  3. width: 1280,
  4. height: 720,
  5. type: Phaser.AUTO,
  6. backgroundColor: "#242424",
  7. scale: {
  8. mode: Phaser.Scale.FIT,
  9. autoCenter: Phaser.Scale.CENTER_BOTH
  10. }
  11. });
  12. game.scene.add("Preload", Preload);
  13. game.scene.add("Level", Level);
  14. game.scene.add("Boot", Boot, true);
  15. });
  16. class Boot extends Phaser.Scene {
  17. preload() {
  18. this.load.pack("pack", "assets/preload-asset-pack.json");
  19. }
  20. create() {
  21. this.scene.start("Preload");
  22. }
  23. }