summaryrefslogtreecommitdiff
path: root/game/entities
diff options
context:
space:
mode:
Diffstat (limited to 'game/entities')
-rw-r--r--game/entities/collisionMap.js32
-rw-r--r--game/entities/hud.js2
2 files changed, 32 insertions, 2 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
diff --git a/game/entities/hud.js b/game/entities/hud.js
index a7b39a0..43e7a21 100644
--- a/game/entities/hud.js
+++ b/game/entities/hud.js
@@ -7,14 +7,12 @@ var Hud = function(game, player, x, y, scorefontKey, keyboardSpriteKey) {
this.player = player;
this.scale = {x: 0.02, y: 0.02};
-
this.background = new Phaser.Sprite(this.game, 0, 0, 'hud-bg');
this.add(this.background);
this.scoreText = new Phaser.BitmapText(this.game, 172, 10, scorefontKey, '0', 100);
this.add(this.scoreText);
this.poisonIndicator = new Phaser.Sprite(this.game, 200, 150, 'poison-pill');
- //this.poisonIndicator.scale = {0.1, 0.1};
this.poisonIndicator.anchor = {x:0.5, y:0.5};
this.add(this.poisonIndicator);