diff --git a/app/ecs-components/tile-layers.js b/app/ecs-components/tile-layers.js index 2741f64..5198e30 100644 --- a/app/ecs-components/tile-layers.js +++ b/app/ecs-components/tile-layers.js @@ -66,6 +66,12 @@ export default function(Component) { } Component.markChange(instance.entity, 'layerChange', {[index]: changes}); } + tile({x, y}) { + if (x < 0 || y < 0 || x >= this.layer.area.x || y >= this.layer.area.y) { + return undefined; + } + return this.layer.data[y * this.layer.area.x + x]; + } } return new LayerProxy(layers[index]); };