mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-25 07:22:33 -05:00
Small WeDo 2.0 fixups
This commit is contained in:
parent
96fa7315d5
commit
1a9e28bfc9
1 changed files with 4 additions and 2 deletions
|
@ -245,7 +245,7 @@ class WeDo2 {
|
||||||
* @return {number} - the latest value received from the distance sensor.
|
* @return {number} - the latest value received from the distance sensor.
|
||||||
*/
|
*/
|
||||||
get distance () {
|
get distance () {
|
||||||
return this._sensors.distance;
|
return this._sensors.distance * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -732,8 +732,10 @@ class Scratch3WeDo2Blocks {
|
||||||
whenDistance (args) {
|
whenDistance (args) {
|
||||||
switch (args.OP) {
|
switch (args.OP) {
|
||||||
case '<':
|
case '<':
|
||||||
|
case '<':
|
||||||
return this._device.distance < args.REFERENCE;
|
return this._device.distance < args.REFERENCE;
|
||||||
case '>':
|
case '>':
|
||||||
|
case '>':
|
||||||
return this._device.distance > args.REFERENCE;
|
return this._device.distance > args.REFERENCE;
|
||||||
default:
|
default:
|
||||||
log.warn(`Unknown comparison operator in whenDistance: ${args.OP}`);
|
log.warn(`Unknown comparison operator in whenDistance: ${args.OP}`);
|
||||||
|
@ -755,7 +757,7 @@ class Scratch3WeDo2Blocks {
|
||||||
* @return {number} - the distance sensor's value, scaled to the [0,100] range.
|
* @return {number} - the distance sensor's value, scaled to the [0,100] range.
|
||||||
*/
|
*/
|
||||||
getDistance () {
|
getDistance () {
|
||||||
return this._device.distance * 10;
|
return this._device.distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue