-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScene.js
54 lines (41 loc) · 1.12 KB
/
Scene.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
43
44
45
46
47
48
49
50
51
52
53
54
// @flow
import ComponentManager from "./ComponentManager";
import MapEngine from "./MapEngine/MapEngine";
import MapLayer from "./MapEngine/MapLayer";
import TileMap from "./MapEngine/TileMap";
import TileSet from "./MapEngine/TileSet";
class Scene {
manager: ComponentManager;
mapEngine: MapEngine;
resources: any;
tileSet: TileSet;
mapLayer: MapLayer;
tileMap: TileMap;
constructor() {
this.manager = new ComponentManager();
this.mapEngine = new MapEngine(16);
}
initialise() {
this.manager.initialise();
this.mapEngine.initialise();
this.mapLayer = new MapLayer(16, 16);
this.tileSet = new TileSet(2, 1, "../assets/images/map.png");
this.tileMap = new TileMap(this.tileSet, this.mapLayer);
}
loadContent(loader: any) {
loader.add(this.tileSet.Texture);
this.manager.loadContent(loader);
}
onLoaded(stage: any) {
this.tileMap.render();
stage.addChild(this.tileMap.Container);
this.manager.onLoaded(stage);
}
update(delta: number) {
this.manager.update(delta);
}
get Manager(): ComponentManager {
return this.manager;
}
}
export default Scene;