diff --git a/src/extensions/scratch3_makeymakey/index.js b/src/extensions/scratch3_makeymakey/index.js index 59c692918..79a73e246 100644 --- a/src/extensions/scratch3_makeymakey/index.js +++ b/src/extensions/scratch3_makeymakey/index.js @@ -86,6 +86,9 @@ class Scratch3MakeyMakeyBlocks { this.keyPressed = this.keyPressed.bind(this); this.runtime.on('KEY_PRESSED', this.keyPressed); + this._clearkeyPressBuffer = this._clearkeyPressBuffer.bind(this); + this.runtime.on('PROJECT_STOP_ALL', this._clearkeyPressBuffer); + /* * An object containing a set of sequence objects. * These are the key sequences currently being detected by the "when @@ -337,6 +340,13 @@ class Scratch3MakeyMakeyBlocks { } } + /** + * Clear the key press buffer. + */ + _clearkeyPressBuffer () { + this.keyPressBuffer = []; + } + /* * Add a key sequence to the set currently being checked on each key press. * @param {string} sequenceString a string of space-separated KEY_IDs.