-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.ts
executable file
·105 lines (97 loc) · 2.71 KB
/
game.ts
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* eslint-disable @typescript-eslint/no-var-requires */
import 'phaser';
import './assets/style.css';
import TextTypingPlugin from 'phaser3-rex-plugins/plugins/texttyping-plugin';
import BBCodeTextPlugin from 'phaser3-rex-plugins/plugins/bbcodetext-plugin';
import MoveToPlugin from 'phaser3-rex-plugins/plugins/moveto-plugin';
import FlashPlugin from 'phaser3-rex-plugins/plugins/flash-plugin';
import UIPlugin from 'phaser3-rex-plugins/plugins/dist/rexuiplugin.min';
import LoginScene from './scenes/login-scene';
import RegisterScene from './scenes/register-scene';
import StartScene from './scenes/start-scene';
import MainScene from './scenes/main-scene';
import TestListScene from './scenes/test-scene';
// Tests
import TestDefault from './scenes/test/test_default';
import TestNPC from './scenes/test/test_npc';
import TestItem from './scenes/test/test_item';
import TestToggle from './scenes/test/test_toggle';
import TestDoor from './scenes/test/test_door';
import TestDoor2 from './scenes/test/test_door2';
import TestObstacle from './scenes/test/test_obstacle';
import IntroScene from './scenes/intro/intro';
const WebFont = require('webfontloader');
const gameConfig: Phaser.Types.Core.GameConfig = {
width: 400,
height: 400,
type: Phaser.WEBGL,
parent: 'phaser',
scale: {
mode: Phaser.Scale.NONE,
autoCenter: Phaser.Scale.NO_CENTER,
},
dom: {
createContainer: true,
},
disableContextMenu: true,
render: {
antialias: false,
pixelArt: true,
roundPixels: true,
},
physics: {
default: 'arcade',
arcade: {
gravity: { y: 0 },
debug: true,
},
},
plugins: {
global: [
{
key: 'rexTextTyping',
plugin: TextTypingPlugin,
start: true,
},
{
key: 'rexBBCodeTextPlugin',
plugin: BBCodeTextPlugin,
start: true,
},
{
key: 'rexMoveTo',
plugin: MoveToPlugin,
start: true,
},
{
key: 'rexFlash',
plugin: FlashPlugin,
start: true,
},
{
key: 'rexUI',
plugin: UIPlugin,
mapping: 'rexUI',
},
],
},
scene: [StartScene, LoginScene, RegisterScene, TestListScene, IntroScene, MainScene,
TestDefault, TestNPC, TestItem, TestToggle, TestDoor, TestDoor2, TestObstacle],
};
export class Game extends Phaser.Game {
// eslint-disable-next-line no-useless-constructor
constructor(config: Phaser.Types.Core.GameConfig) {
super(config);
}
}
window.addEventListener('load', () => {
WebFont.load({
google: {
families: ['Bree Serif'],
},
fontactive: (): void => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const game = new Game(gameConfig);
},
});
});