Make the wait block's logic and behavior more consistent with Scratch 2 ()

This commit is contained in:
Katie Broida 2018-12-04 10:35:42 -05:00 committed by GitHub
parent 536305af1b
commit 967cab8f20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 126 additions and 12 deletions
src/engine

View file

@ -68,6 +68,10 @@ class Sequencer {
stepThreads () {
// Work time is 75% of the thread stepping interval.
const WORK_TIME = 0.75 * this.runtime.currentStepTime;
// For compatibility with Scatch 2, update the millisecond clock
// on the Runtime once per step (see Interpreter.as in Scratch 2
// for original use of `currentMSecs`)
this.runtime.updateCurrentMSecs();
// Start counting toward WORK_TIME.
this.timer.start();
// Count of active threads.
@ -134,6 +138,7 @@ class Sequencer {
activeThread.status === Thread.STATUS_DONE) {
// Finished with this thread.
stoppedThread = true;
this.runtime.updateCurrentMSecs();
}
}
// We successfully ticked once. Prevents running STATUS_YIELD_TICK