diff --git a/src/sprites/clone.js b/src/sprites/clone.js index ce64fda52..169d72cc7 100644 --- a/src/sprites/clone.js +++ b/src/sprites/clone.js @@ -2,6 +2,11 @@ var util = require('util'); var MathUtil = require('../util/math-util'); var Target = require('../engine/target'); +/** + * Clone (instance) of a sprite. + * @param {!Blocks} spriteBlocks Reference to the sprite's blocks. + * @constructor + */ function Clone(spriteBlocks) { Target.call(this, spriteBlocks); this.drawableID = null; diff --git a/src/sprites/sprite.js b/src/sprites/sprite.js index 1ec25b3ba..b4abdbbb5 100644 --- a/src/sprites/sprite.js +++ b/src/sprites/sprite.js @@ -1,8 +1,13 @@ var Clone = require('./clone'); var Blocks = require('../engine/blocks'); +/** + * Sprite to be used on the Scratch stage. + * All clones of a sprite have shared blocks, shared costumes, shared variables. + * @param {?Blocks} blocks Shared blocks object for all clones of sprite. + * @constructor + */ function Sprite (blocks) { - // Sprites have: shared blocks, shared costumes, shared variables, etc. if (!blocks) { // Shared set of blocks for all clones. blocks = new Blocks(); @@ -11,6 +16,10 @@ function Sprite (blocks) { this.clones = []; } +/** + * Create a clone of this sprite. + * @returns {!Clone} Newly created clone. + */ Sprite.prototype.createClone = function () { var newClone = new Clone(this.blocks); this.clones.push(newClone);