mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
There's quite a few interactions between degrees, their sign, and the currently set direction for the motor the degrees relate to. In this case, BoostMotor.turnOnDegrees() was being run with -degrees, and since that function does a Math.max between 0 and degrees, it resulted in 0 degrees. Because of this, and for clarity, turnOnDegrees now only gets called with positive values. If running CCW, that should be specified in the direction-parameter.
This commit is contained in:
parent
e3cdbffa2a
commit
2c6a9d85cf
1 changed files with 4 additions and 4 deletions
|
@ -1719,8 +1719,8 @@ class Scratch3BoostBlocks {
|
|||
if (motor.pendingTimeoutDelay) {
|
||||
motor.turnOnFor(motor.pendingTimeoutStartTime + motor.pendingTimeoutDelay - Date.now());
|
||||
} else if (motor.pendingPositionDestination) {
|
||||
const p = motor.pendingPositionDestination - motor.position;
|
||||
motor.turnOnForDegrees(p, Math.sign(p) * motor.direction);
|
||||
const p = Math.abs(motor.pendingPositionDestination - motor.position);
|
||||
motor.turnOnForDegrees(p, Math.sign(p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1758,8 +1758,8 @@ class Scratch3BoostBlocks {
|
|||
if (motor.pendingTimeoutDelay) {
|
||||
motor.turnOnFor(motor.pendingTimeoutStartTime + motor.pendingTimeoutDelay - Date.now());
|
||||
} else if (motor.pendingPositionDestination) {
|
||||
const p = motor.pendingPositionDestination - motor.position;
|
||||
motor.turnOnForDegrees(p, Math.sign(p) * motor.direction);
|
||||
const p = Math.abs(motor.pendingPositionDestination - motor.position);
|
||||
motor.turnOnForDegrees(p, Math.sign(p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue