diff options
author | Justin Worthe <justin.worthe@gmail.com> | 2014-09-24 17:20:56 +0200 |
---|---|---|
committer | Justin Worthe <justin.worthe@gmail.com> | 2014-09-24 17:20:56 +0200 |
commit | 17ebd1e3857d47ad5fd94e40283ecd468dd83739 (patch) | |
tree | 6e65cf51bc9411af4c2d77a274838cebd32df85c /game/entities/entityBase.js | |
parent | 1eabe62fcf61001a10b1965da0cf3a4ae741a25b (diff) |
Moved common game entity code into parent class
Diffstat (limited to 'game/entities/entityBase.js')
-rw-r--r-- | game/entities/entityBase.js | 14 |
1 files changed, 14 insertions, 0 deletions
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 |