diff --git a/packages/topdown/layer.js b/packages/topdown/layer.js index c7ba1da..2b7194b 100644 --- a/packages/topdown/layer.js +++ b/packages/topdown/layer.js @@ -1,3 +1,6 @@ +import * as I from 'immutable'; + +import {EntityList} from '@avocado/entity'; import {Tiles} from '@avocado/topdown'; export class Layer { @@ -5,7 +8,8 @@ export class Layer { constructor() { this.tiles = undefined; this.tilesetUri = undefined; - this.entityList = undefined; + this.entityList = new EntityList(); + this._state = I.Map(); } fromJSON(json) { @@ -18,4 +22,15 @@ export class Layer { return this; } + get state() { + return this._state; + } + + tick(elapsed) { + if (this.entityList) { + this.entityList.tick(elapsed); + this._state = this._state.set('entityList', this.entityList.state); + } + } + } \ No newline at end of file