mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Fixing #1364: Microbit 'button pressed?' block should return true/false.
This commit is contained in:
parent
cfe7e45d8b
commit
4b2b82a224
1 changed files with 3 additions and 3 deletions
|
@ -751,11 +751,11 @@ class Scratch3MicroBitBlocks {
|
||||||
*/
|
*/
|
||||||
isButtonPressed (args) {
|
isButtonPressed (args) {
|
||||||
if (args.BTN === 'any') {
|
if (args.BTN === 'any') {
|
||||||
return this._peripheral.buttonA | this._peripheral.buttonB;
|
return (this._peripheral.buttonA | this._peripheral.buttonB) === 1;
|
||||||
} else if (args.BTN === 'A') {
|
} else if (args.BTN === 'A') {
|
||||||
return this._peripheral.buttonA;
|
return this._peripheral.buttonA === 1;
|
||||||
} else if (args.BTN === 'B') {
|
} else if (args.BTN === 'B') {
|
||||||
return this._peripheral.buttonB;
|
return this._peripheral.buttonB === 1;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue