diff options
author | Justin Worthe <justin.worthe@gmail.com> | 2014-09-26 08:12:39 +0200 |
---|---|---|
committer | Justin Worthe <justin.worthe@gmail.com> | 2014-09-26 08:12:39 +0200 |
commit | 959915d7d89e8d967124657a901dad4f28459314 (patch) | |
tree | ef0cb8b74bf4be79ad4bcc0e93e6e008a3a14e5b /game/entities/collisionMap.js | |
parent | 17ebd1e3857d47ad5fd94e40283ecd468dd83739 (diff) |
Started reordering methods in play state
Diffstat (limited to 'game/entities/collisionMap.js')
-rw-r--r-- | game/entities/collisionMap.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/game/entities/collisionMap.js b/game/entities/collisionMap.js new file mode 100644 index 0000000..fa0a29e --- /dev/null +++ b/game/entities/collisionMap.js @@ -0,0 +1,32 @@ +'use strict'; + +var CollisionMap = function() { + this.map = []; +}; + +CollisionMap.prototype = { + addToMap: function(x, y) { + if (!this.map) { + this.map = []; + } + if (!this.map[x]) { + this.map[x] = []; + } + + this.map[x][y] = true; + }, + removeFromMap: function(x,y) { + if (!this.map || !this.map[x]) { + return; + } + this.map[x][y] = false; + }, + checkMap: function(x,y) { + if (!this.map || !this.map[x]) { + return false; + } + return !!this.map[x][y]; + } +} + +module.exports = CollisionMap;
\ No newline at end of file |