summaryrefslogtreecommitdiff
path: root/client/src/app.ts
blob: 197fb63e83f16c21e5e33c8ed9691894bdec2733 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// // import Phaser from 'phaser';
// import AkkamonStartScene from './scene';
// import { AkkamonUI } from './uiScene';
// import { Client } from './client';
//
// const serviceUrl = 'ws://localhost:8080';
//
// export const akkamonClient = new Client(serviceUrl);
//
//
// const game: Phaser.Game = new Phaser.Game(config);


import Phaser from 'phaser';
import { gameConfig } from './akkamon/GameConfig';
import { Client } from './akkamon/client/Client';

function newGame () {
  if (game) return;
  game = new Phaser.Game(gameConfig);
}

function destroyGame () {
  if (!game) return;
  game.destroy(true);
  game = null;
}

export let client = new Client('ws://localhost:8080');
let game: Phaser.Game | null | undefined;

if (!game) newGame();