mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-04 01:24:58 -04: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_repeat_until': this.repeatUntil,
|
||||||
'control_forever': this.forever,
|
'control_forever': this.forever,
|
||||||
'control_wait': this.wait,
|
'control_wait': this.wait,
|
||||||
|
'control_wait_until': this.waitUntil,
|
||||||
'control_if': this.if,
|
'control_if': this.if,
|
||||||
'control_if_else': this.ifElse,
|
'control_if_else': this.ifElse,
|
||||||
'control_stop': this.stop,
|
'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) {
|
Scratch3ControlBlocks.prototype.forever = function(args, util) {
|
||||||
// Only execute once per frame.
|
// Only execute once per frame.
|
||||||
// When the branch finishes, `forever` will be executed again and
|
// When the branch finishes, `forever` will be executed again and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue