mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-22 22:12:28 -05:00
Merge pull request #2335 from daikifukumori/fix/tilted-any-trigger
WeDo 2.0 isTilted-any function bug fix
This commit is contained in:
commit
32f87b3396
1 changed files with 4 additions and 2 deletions
|
@ -1543,8 +1543,10 @@ class Scratch3WeDo2Blocks {
|
|||
_isTilted (direction) {
|
||||
switch (direction) {
|
||||
case WeDo2TiltDirection.ANY:
|
||||
return (Math.abs(this._peripheral.tiltX) >= Scratch3WeDo2Blocks.TILT_THRESHOLD) ||
|
||||
(Math.abs(this._peripheral.tiltY) >= Scratch3WeDo2Blocks.TILT_THRESHOLD);
|
||||
return this._getTiltAngle(WeDo2TiltDirection.UP) >= Scratch3WeDo2Blocks.TILT_THRESHOLD ||
|
||||
this._getTiltAngle(WeDo2TiltDirection.DOWN) >= Scratch3WeDo2Blocks.TILT_THRESHOLD ||
|
||||
this._getTiltAngle(WeDo2TiltDirection.LEFT) >= Scratch3WeDo2Blocks.TILT_THRESHOLD ||
|
||||
this._getTiltAngle(WeDo2TiltDirection.RIGHT) >= Scratch3WeDo2Blocks.TILT_THRESHOLD;
|
||||
default:
|
||||
return this._getTiltAngle(direction) >= Scratch3WeDo2Blocks.TILT_THRESHOLD;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue