mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -05:00
Merge pull request #1832 from ericrosenbaum/bugfix/makey-fixes
Makey Makey extension fixes
This commit is contained in:
commit
d2a6a0faa1
1 changed files with 11 additions and 1 deletions
|
@ -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
|
||||
|
@ -155,7 +158,7 @@ class Scratch3MakeyMakeyBlocks {
|
|||
`${KEY_ID_UP} ${KEY_ID_DOWN}`,
|
||||
`${KEY_ID_DOWN} ${KEY_ID_UP}`,
|
||||
`${KEY_ID_UP} ${KEY_ID_RIGHT} ${KEY_ID_DOWN} ${KEY_ID_LEFT}`,
|
||||
`${KEY_ID_SPACE} ${KEY_ID_SPACE} ${KEY_ID_SPACE}`,
|
||||
`${KEY_ID_UP} ${KEY_ID_LEFT} ${KEY_ID_DOWN} ${KEY_ID_RIGHT}`,
|
||||
`${KEY_ID_UP} ${KEY_ID_UP} ${KEY_ID_DOWN} ${KEY_ID_DOWN} ` +
|
||||
`${KEY_ID_LEFT} ${KEY_ID_RIGHT} ${KEY_ID_LEFT} ${KEY_ID_RIGHT}`
|
||||
];
|
||||
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue