From 4fa246628bd9e5911ae998162f0bdc724cc739d2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 6 Jan 2016 08:52:06 +0100 Subject: Add entity rendering --- src/control/MapContext.coffee | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/control/MapContext.coffee (limited to 'src/control/MapContext.coffee') diff --git a/src/control/MapContext.coffee b/src/control/MapContext.coffee new file mode 100644 index 0000000..df6efec --- /dev/null +++ b/src/control/MapContext.coffee @@ -0,0 +1,29 @@ +'use strict' + + +Direction = require '../model/Direction' +Entity = require '../model/Entity' +EntityPosition = require '../model/EntityPosition' +Position = require '../model/Position' + +MapView = require '../view/MapView' + + +class MapContext + constructor: (@map) -> + @entities = {} + + @playerEntity = new EntityPosition( + new Entity('square'), + new Position(8, 8), + Direction.EAST) + + @addEntity(@playerEntity) + + @mavView = new MapView @map, @entities + + addEntity: (entity) => + @entities[entity.position.asString()] = entity + + +module.exports = MapContext -- cgit v1.2.3