From ad82a5cb74ef9b951fcffa0d3e13fa7c0bfe1dd4 Mon Sep 17 00:00:00 2001 From: Tim Mickel Date: Wed, 31 Aug 2016 11:50:10 -0400 Subject: [PATCH] Add naming mechanism for targets/clones --- src/engine/target.js | 10 ++++++++++ src/sprites/clone.js | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/src/engine/target.js b/src/engine/target.js index 53591cc08..acb2b30a6 100644 --- a/src/engine/target.js +++ b/src/engine/target.js @@ -27,4 +27,14 @@ function Target (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; diff --git a/src/sprites/clone.js b/src/sprites/clone.js index ba025ab73..408667ab8 100644 --- a/src/sprites/clone.js +++ b/src/sprites/clone.js @@ -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;