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/model/Direction.coffee | 13 +++++++++++++ src/model/Entity.coffee | 8 ++++++++ src/model/EntityPosition.coffee | 8 ++++++++ src/model/Map.coffee | 8 -------- src/model/MapData.coffee | 9 +++++++++ src/model/Position.coffee | 10 ++++++++++ 6 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 src/model/Direction.coffee create mode 100644 src/model/Entity.coffee create mode 100644 src/model/EntityPosition.coffee delete mode 100644 src/model/Map.coffee create mode 100644 src/model/MapData.coffee create mode 100644 src/model/Position.coffee (limited to 'src/model') diff --git a/src/model/Direction.coffee b/src/model/Direction.coffee new file mode 100644 index 0000000..5c49c80 --- /dev/null +++ b/src/model/Direction.coffee @@ -0,0 +1,13 @@ +'use strict' + + +Direction = + NORTH: 0 + EAST: 1 + SOUTH: 2 + WEST: 3 + + reverse: (d) -> (d+2)%4 + + +module.exports = Direction diff --git a/src/model/Entity.coffee b/src/model/Entity.coffee new file mode 100644 index 0000000..70c81fa --- /dev/null +++ b/src/model/Entity.coffee @@ -0,0 +1,8 @@ +'use strict' + + +class Entity + constructor: (@name) -> + + +module.exports = Entity diff --git a/src/model/EntityPosition.coffee b/src/model/EntityPosition.coffee new file mode 100644 index 0000000..aaf9531 --- /dev/null +++ b/src/model/EntityPosition.coffee @@ -0,0 +1,8 @@ +'use strict' + + +class EntityPosition + constructor: (@entity, @position, @direction) -> + + +module.exports = EntityPosition diff --git a/src/model/Map.coffee b/src/model/Map.coffee deleted file mode 100644 index e97b1ed..0000000 --- a/src/model/Map.coffee +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' - -class Map - constructor: (data) -> - {@tiles, @collition, @layers} = data - - -module.exports = Map diff --git a/src/model/MapData.coffee b/src/model/MapData.coffee new file mode 100644 index 0000000..39b2140 --- /dev/null +++ b/src/model/MapData.coffee @@ -0,0 +1,9 @@ +'use strict' + + +class MapData + constructor: (data) -> + {@tiles, @collition, @layers} = data + + +module.exports = MapData diff --git a/src/model/Position.coffee b/src/model/Position.coffee new file mode 100644 index 0000000..08bb999 --- /dev/null +++ b/src/model/Position.coffee @@ -0,0 +1,10 @@ +'use strict' + + +class Position + constructor: (@x, @y) -> + + asString: => "#{@x},#{@y}" + + +module.exports = Position -- cgit v1.2.3