mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-03-14 01:09:51 -04:00
Merge pull request #1990 from evhan55/bug/gdxfor-tilt
Vernier gdxfor tilt values 0 when disconnected
This commit is contained in:
commit
894828d54b
1 changed files with 6 additions and 0 deletions
|
@ -775,6 +775,12 @@ class Scratch3GdxForBlocks {
|
|||
}
|
||||
|
||||
getTilt (args) {
|
||||
// Tilt values are calculated using acceleration due to gravity,
|
||||
// so we need to return 0 when the peripheral is not connected.
|
||||
if (!this._peripheral.isConnected()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (args.TILT) {
|
||||
case TiltAxisValues.FRONT:
|
||||
return Math.round(this._peripheral.getTiltFrontBack(false));
|
||||
|
|
Loading…
Reference in a new issue