mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-10 06:52:00 -05:00
"Wait until" implementation (#210)
This commit is contained in:
parent
a118d50056
commit
2d736f2b87
1 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue