diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index af8ed9d70..b2bad1ef7 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -12,6 +12,8 @@ function Scratch3LooksBlocks(runtime) { */ Scratch3LooksBlocks.prototype.getPrimitives = function() { return { + 'looks_show': this.show, + 'looks_hide': this.hide, 'looks_effectmenu': this.effectMenu, 'looks_changeeffectby': this.changeEffect, 'looks_seteffectto': this.setEffect, @@ -22,6 +24,14 @@ Scratch3LooksBlocks.prototype.getPrimitives = function() { }; }; +Scratch3LooksBlocks.prototype.show = function (args, util) { + util.target.setVisible(true); +}; + +Scratch3LooksBlocks.prototype.hide = function (args, util) { + util.target.setVisible(false); +}; + Scratch3LooksBlocks.prototype.effectMenu = function (args) { return args.EFFECT.toLowerCase(); }; diff --git a/src/sprites/clone.js b/src/sprites/clone.js index cfee61556..a1c8b5c8d 100644 --- a/src/sprites/clone.js +++ b/src/sprites/clone.js @@ -24,6 +24,8 @@ Clone.prototype.y = 0; Clone.prototype.direction = 90; +Clone.prototype.visible = true; + Clone.prototype.size = 100; Clone.prototype.effects = { @@ -51,6 +53,16 @@ Clone.prototype.setDirection = function (direction) { }); }; +Clone.prototype.setVisible = function (visible) { + this.visible = visible; + // @todo: Until visibility is implemented in the renderer, use a ghost. + if (this.visible) { + this.setEffect('ghost', 0); + } else { + this.setEffect('ghost', 100); + } +}; + Clone.prototype.setSize = function (size) { this.size = MathUtil.clamp(size, 5, 535); self.renderer.updateDrawableProperties(this.drawableID, {