From 17ebd1e3857d47ad5fd94e40283ecd468dd83739 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Wed, 24 Sep 2014 17:20:56 +0200 Subject: Moved common game entity code into parent class --- game/entities/entityBase.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 game/entities/entityBase.js (limited to 'game/entities/entityBase.js') diff --git a/game/entities/entityBase.js b/game/entities/entityBase.js new file mode 100644 index 0000000..1c70b92 --- /dev/null +++ b/game/entities/entityBase.js @@ -0,0 +1,14 @@ +'use strict'; + +var EntityBase = function(game, x, y, key) { + Phaser.Sprite.call(this, game, x, y, key); + this.scale = {x: 0.01, y: 0.01}; + this.anchor = {x: 0.5, y: 0.5}; +}; +EntityBase.prototype = Object.create(Phaser.Sprite.prototype); + +EntityBase.prototype.getBounds = function() { + return new Phaser.Rectangle(this.x, this.y, 0.5, 0.5); +}; + +module.exports = EntityBase; \ No newline at end of file -- cgit v1.2.3