-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
30 lines (24 loc) · 975 Bytes
/
index.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
import * as me from 'melonjs/dist/melonjs.module.js';
import 'index.css';
import PlayScreen from 'js/stage/play.js';
import PlayerEntity from 'js/renderables/player.js';
import EnemyEntity from 'js/renderables/enemy.js';
import Laser from './js/laser.js';
import DataManifest from 'manifest.js';
me.device.onReady(() => {
setTimeout(() => {
if (!me.video.init(1218, 562, { parent: "screen", scale: "auto", scaleMethod: "flex-width" })) {
alert("Your browser does not support HTML5 canvas.");
return;
};
me.audio.init("mp3,ogg");
me.loader.crossOrigin = "anonymous";
me.loader.preload(DataManifest, function () {
me.state.set(me.state.PLAY, new PlayScreen());
me.pool.register("player", PlayerEntity);
me.pool.register("ships", EnemyEntity);
me.pool.register("laser", Laser);
me.state.change(me.state.PLAY);
});
}, 5000);
});