Add naming mechanism for targets/clones

This commit is contained in:
Tim Mickel 2016-08-31 11:50:10 -04:00
parent 2c6722b958
commit ad82a5cb74
2 changed files with 19 additions and 0 deletions

View file

@ -27,4 +27,14 @@ function Target (blocks) {
this.blocks = blocks; this.blocks = blocks;
} }
/**
* Return a human-readable name for this target.
* Target implementations should override this.
* @abstract
* @returns {string} Human-readable name for the target.
*/
Target.prototype.getName = function () {
return this.id;
};
module.exports = Target; module.exports = Target;

View file

@ -226,4 +226,13 @@ Clone.prototype.updateAllDrawableProperties = function () {
} }
}; };
/**
* Return the human-readable name for this clone, i.e., the sprite's name.
* @override
* @returns {string} Human-readable name for the clone.
*/
Clone.prototype.getName = function () {
return this.sprite.name;
};
module.exports = Clone; module.exports = Clone;