diff --git a/src/blocks/scratch3_control.js b/src/blocks/scratch3_control.js index 5f3370895..eab6c1a0f 100644 --- a/src/blocks/scratch3_control.js +++ b/src/blocks/scratch3_control.js @@ -19,6 +19,7 @@ Scratch3ControlBlocks.prototype.getPrimitives = function() { 'control_repeat_until': this.repeatUntil, 'control_forever': this.forever, 'control_wait': this.wait, + 'control_wait_until': this.waitUntil, 'control_if': this.if, 'control_if_else': this.ifElse, 'control_stop': this.stop, @@ -76,6 +77,14 @@ Scratch3ControlBlocks.prototype.repeatUntil = function(args, util) { } }; +Scratch3ControlBlocks.prototype.waitUntil = function(args, util) { + var condition = Cast.toBoolean(args.CONDITION); + // Only execute once per frame. + if (!condition) { + util.yieldFrame(); + } +}; + Scratch3ControlBlocks.prototype.forever = function(args, util) { // Only execute once per frame. // When the branch finishes, `forever` will be executed again and