-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgame.js
42 lines (35 loc) · 944 Bytes
/
game.js
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
import Phaser from 'phaser'
import { PokiPlugin } from '../lib'
// In this example we use '../lib' because it's in the same repository, in
// an actual project you should use:
// import { PokiPlugin } from '@poki/phaser-3'
import LoadingScene from './scenes/loading'
const config = {
parent: 'game',
backgroundColor: '#f0f5fc',
plugins: {
global: [
{
plugin: PokiPlugin,
key: 'poki',
start: true,
data: {
loadingSceneKey: 'LoadingScene',
gameplaySceneKey: 'PlayScene',
autoCommercialBreak: true
}
}
]
}
}
export default class Game extends Phaser.Game {
start () {
super.start()
this.input.keyboard.addCapture('SPACE') // to prevent the page from scrolling
this.scene.add('LoadingScene', LoadingScene, true)
}
}
document.addEventListener('DOMContentLoaded', () => {
const game = new Game(config)
window.game = game
})